Unable to locate package php7 4 debian 10

I recently upgraded from debian9 (stretch) to debian10 (buster). Which also includes upgrading to php7.4. For some reason php-curl cannot install.

I run apt install php7.4-curl and the error I get is:

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php7.4-curl : Depends: libcurl3 (>= 7.44.0) but it is not installable
E: Unable to correct problems, you have held broken packages.

I cannot see any held packages, anywhere. I have tried:

apt-mark showhold
dpkg --audit
dpkg --configure -a
apt-get install -f
apt-get clean
apt-get update
apt-get autoremove

I have also tried removing curl, purge, autoremove, and then reinstall. Same thing.

I try installing libcurl3

Package libcurl3 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
However the following packages replace it:
  libcurl4

After adding the ppa ondrej/php, I try sudo apt-get install php7.4, but the output is

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package php7.4
E: Couldn't find any package by glob 'php7.4'
E: Couldn't find any package by regex 'php7.4'

I have checked and there is a package that should install with that command, but I must be doing something wrong?

Jay Blanchard

33.7k16 gold badges73 silver badges114 bronze badges

asked Apr 29, 2020 at 18:43

3

have you tried updating your rep?

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php7.4
php -v

I didn't pay enough attention, this package doesn't exist yet for ubuntu 19.04:

php7.4  7.4.2-6+ubuntu19.10.1+deb.sury.org+1    Ondrej Surý (2020-02-05)
php7.4  7.4.2-6+ubuntu18.04.1+deb.sury.org+1    Ondrej Surý (2020-02-05)
php7.4  7.4.2-6+ubuntu16.04.1+deb.sury.org+1    Ondrej Surý (2020-02-05)

answered Apr 29, 2020 at 18:48

Ali AdibyAli Adiby

4884 silver badges9 bronze badges

4

PHP is an open-source programming language used for web development, created by Rasmus Lerdorf. It is an HTML-embedded scripting language for creating dynamic web sites.

In this post, we will see how to install PHP 7.4 / 7.3 / 7.2 / 7.1 on Debian 10 / Debian 9.

Add PHP Repository

SURY, a third-party repository which offers PHP 7.4 / 7.3 / 7.2 / 7.1 for Debian operating system.

By default, Debian 10 ships PHP v7.3. So, you can either install PHP v7.3 from Debian repository or SURY repository. Skip this section if you want to install PHP 7.3 from the Debian repository. However, if you want to install PHP 7.4 / 7.2 / 7.1 on Debian 10, you must set up SURY repository.

Update the repository cache.

sudo apt update

Install the below packages.

sudo apt install -y curl wget gnupg2 ca-certificates lsb-release apt-transport-https

Import the public using the below commands.

wget https://packages.sury.org/php/apt.gpg

sudo apt-key add apt.gpg

Add the SURY repository to your system.

echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php7.list

Update the repository index.

sudo apt update

Install PHP 7.4 on Debian 10 / Debian 9

Install PHP v7.4 with the following command.

sudo apt install -y php7.4 php7.4-cli php7.4-common

Install PHP 7.3 on Debian 10 / Debian 9

Install PHP v7.3 with the following command.

sudo apt install -y php7.3 php7.3-cli php7.3-common

Install PHP 7.2 on Debian 10 / Debian 9

Install PHP v7.2 with the following command.

sudo apt install -y php7.2 php7.2-cli php7.2-common

Install PHP 7.1 on Debian 10 / Debian 9

Install PHP v7.1 with the following command.

sudo apt install -y php7.1 php7.1-cli php7.1-common

You can also have multiple PHP versions on your system. Each PHP version will have separate configuration files under /etc/php/7.X directory.

Set Default PHP Version

You can set the default PHP version with the below command incase your system has multiple PHP versions. Change php7.3 with the version you want to set as the default PHP version.

sudo update-alternatives --set php /usr/bin/php7.3

Check PHP Version

Once you installed the PHP, check the version.

php -v

Output:

PHP 7.4.1 (cli) (built: Dec 18 2019 15:00:01) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.1, Copyright (c), by Zend Technologies

PHP Support for Web Server

Both Apache and Nginx do not support processing of PHP files by default when the browser requests the PHP page. So, we need to install the PHP package on the server to support PHP files.

PHP Support for Apache

You can install a below package with Apache webserver to support PHP. This package provides the PHP modules for Apache 2 web server. Change PHP version, if required

sudo apt install -y apache2 libapache2-mod-php7.4

PHP Support for Ngnix

Nginx does not have a PHP modules package to support PHP. But, we can use the PHP FastCGI Process Manager to handle PHP requests. Change PHP version, if required

sudo apt install -y php7.4-fpm

Once you have installed FastCGI manager, add socket details in Nginx virtual host.

server {

# other codes

  location ~* \.php$ {
    fastcgi_pass unix:/run/php/php7.4-fpm.sock;
    include         fastcgi_params;
    fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
  }
}

Install PHP Extensions

PHP extensions enable specific functions/support for your code. For example, installing PHP MySQL extension will let your PHP code to connect with the MySQL database.

PHP extensions package is normally named like php<version>-<extn_name>.

To install MySQL support for PHP v7.4, you can install php7.4-mysql package.

sudo apt install -y php7.4-mysql

Once you have installed a required extension, use the below command to verify it.

php -m | grep -i mysql

Output:

mysqli
mysqlnd
pdo_mysql

PHP Extensions for CMS

PHP Extensions for WordPress

The following extensions are required to install and run WordPress on your Debian system. WordPress recommends having PHP v7.3 for the installation.

sudo apt install -y php7.3-mysql php7.3-dom php7.3-simplexml php7.3-ssh2 php7.3-xml php7.3-xmlreader php7.3-curl  php7.3-exif  php7.3-ftp php7.3-gd  php7.3-iconv php7.3-imagick php7.3-json  php7.3-mbstring php7.3-posix php7.3-sockets php7.3-tokenizer

PHP Extensions for Joomla

The following extensions are required to install and run Joomla on your Debian system. Joomla requires PHP v7.1 and above.

sudo apt install -y php7.3-mysql php7.3-xml php-pear php7.3-json

PHP Extensions for Drupal

The following extensions are required to install and run Drupal on your Debian system. Drupal requires PHP v7.1 and above.

sudo apt install -y php7.3-mysql php7.3-dom php7.3-gd php7.3-json php7.3-pdo php7.3-simplexml php7.3-tokenizer php7.3-xml

Conclusion

That’s All. Please share your feedback in the comments section.

Could not find any package php7 4?

To Solve Unable to locate package php7. 4 Error If You are trying to install php with Ondrej PPA Then it is only supports the Ubuntu 21.04, 20.10, 20.04, 18.04 You are trying with 16.04 which is too OLD so Long Term Solution is Just update your Ubuntu atleast 18.04 to 21.04.

How install PHP modules Debian 11?

How to Install PHP 7.4 on Debian 11 Bullseye.
Update Debian..
Install Required Packages..
Import Ondřej Surý PHP Repository..
Install PHP 7.4 with Apache Option. Install Apache Module. Install Apache with PHP-FPM..
Install PHP 7.4 with Nginx Option..
Comments and Conclusion..

How do I download PHP on Debian?

Install PHP 7.4 on Debian 10 / Debian 9.
Step 1: Update system. Ensure your system is updated: sudo apt update sudo apt upgrade -y && sudo reboot..
Step 2: Add SURY PHP PPA repository. Download and store PPA repository in a file on your Debian Server/Desktop. ... .
Step 3: Install PHP 7.4 on Debian 10 / Debian 9..