Ondřej Krajčík
Ondřej Krajčík

Reputation: 161

Install php7.4-cgi in Debian 10

I`m using docker image php:7.4.3-apache and I need to install php7.4-cgi. Image is running on Debian 10. I was tried many tutorials but without success.

Etc. this tutorial https://kifarunix.com/install-php-7-4-on-debian-10-debian-9/

When I run installation command then I get following error:

root@eafa0aac715a:/usr/local/bin# apt install php7.4-cgi
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package php7.4-cgi is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'php7.4-cgi' has no installation candidate

I don`t known what I am doing bad.

I was created new clear dockerfile:

FROM php:7.4.3-apache

RUN apt-get -y install apt-transport-https lsb-release ca-certificates curl
RUN wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
RUN sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
RUN apt-get update
RUN apt install php7.4-cgi

Is there somebody who can fix this dockerfile for build?

Upvotes: 2

Views: 4787

Answers (1)

leo95batista
leo95batista

Reputation: 767

Did you correctly configure the repositories to be able to install php?. In my case I use the following repository to install the PHP packages:

https://packages.sury.org/php/

How can you configure it in Debian 10?

First install the necessary packages

apt-get -y install apt-transport-https lsb-release ca-certificates curl

Following this, add the GPG key

wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg

then you create a file with following command inside sources.list.d directory so apt use this repository when updating

sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'

and perform an apt-update

apt-get update

after this, you only have to install the package you were trying to install

apt install php7.4-cgi

Upvotes: 0

Related Questions