PHP 7.4 on Ubuntu 18.04 (bionic)
I'm having trouble getting PHP 7.4 to install on 18.04 now, as it seems to depend on a version of libc6
that is not available on 18.04.
I have no tried building from source as I would like to avoid that if possible.
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php7.4-fpm
results in
The following packages have unmet dependencies:
php7.4-fpm : Depends: php7.4-cli but it is not going to be installed
Depends: php7.4-common (= 7.4.22-1+ubuntu20.04.1+deb.sury.org+1) but it is not going to be installed
Depends: php7.4-json but it is not going to be installed
Depends: php7.4-opcache but it is not going to be installed
Depends: libc6 (>= 2.29) but 2.27-3ubuntu1.4 is to be installed
E: Unable to correct problems, you have held broken packages.
If I look specifically at lib6c we can see there is nothing available to satisfy the version requirement:
$ sudo apt-cache policy libc6
libc6:
Installed: 2.27-3ubuntu1.4
Candidate: 2.27-3ubuntu1.4
Version table:
*** 2.27-3ubuntu1.4 500
500 http://us-east1.gce.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
100 /var/lib/dpkg/status
2.27-3ubuntu1.2 500
500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
2.27-3ubuntu1 500
500 http://us-east1.gce.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
Solution 1:
This may not be very helpful, but I was able to install php7.4-fpm on Ubuntu 18.04LTS with no errors. I originally needed php7.4 for use with Matomo. I used this writeup Update to PHP 7.4 on Ubuntu 18.04 on Digital Ocean for WordPress as applicable to my setup.
I didn't technically need the php7.4-fpm, but decided to test it after seeing this post. Installed with no issues reported. Here's what I have:
Ubuntu
Linux 4.15.0-154-generic #161-Ubuntu SMP Fri Jul 30 13:04:17 UTC 2021
Distributor ID: Ubuntu
Description: Ubuntu 18.04.5 LTS
Release: 18.04
Codename: bionic
libc6
$ sudo apt-cache policy libc6
libc6:
Installed: 2.27-3ubuntu1.4
Candidate: 2.27-3ubuntu1.4
Version table:
*** 2.27-3ubuntu1.4 500
500 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
100 /var/lib/dpkg/status
2.27-3ubuntu1.2 500
500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
2.27-3ubuntu1 500
500 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages
php7.4-fpm
$ sudo apt-cache policy php7.4-fpm
php7.4-fpm:
Installed: 7.4.23-1+ubuntu18.04.1+deb.sury.org+1
Candidate: 7.4.23-1+ubuntu18.04.1+deb.sury.org+1
Version table:
*** 7.4.23-1+ubuntu18.04.1+deb.sury.org+1 500
500 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 Packages
100 /var/lib/dpkg/status
And the full report from php7.4-fpm install:
$ sudo apt install php7.4-fpm
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
php7.4-fpm
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,410 kB of archives.
After this operation, 4,750 kB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 php7.4-fpm amd64 7.4.23-1+ubuntu18.04.1+deb.sury.org+1 [1,410 kB]
Fetched 1,410 kB in 1s (1,514 kB/s)
Selecting previously unselected package php7.4-fpm.
(Reading database ... 27179 files and directories currently installed.)
Preparing to unpack .../php7.4-fpm_7.4.23-1+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.4-fpm (7.4.23-1+ubuntu18.04.1+deb.sury.org+1) ...
Setting up php7.4-fpm (7.4.23-1+ubuntu18.04.1+deb.sury.org+1) ...
Creating config file /etc/php/7.4/fpm/php.ini with new version
NOTICE: Not enabling PHP 7.4 FPM by default.
NOTICE: To enable PHP 7.4 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php7.4-fpm
NOTICE: You are seeing this message because you have apache2 package installed.
Created symlink /etc/systemd/system/multi-user.target.wants/php7.4-fpm.service → /lib/systemd/system/php7.4-fpm.service.
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ureadahead (0.100.0-21) ...
Processing triggers for systemd (237-3ubuntu10.51) ...
Processing triggers for php7.4-fpm (7.4.23-1+ubuntu18.04.1+deb.sury.org+1) ...
NOTICE: Not enabling PHP 7.4 FPM by default.
NOTICE: To enable PHP 7.4 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php7.4-fpm
NOTICE: You are seeing this message because you have apache2 package installed.