我现在无法在 18.04 上安装 PHP 7.4,因为它似乎依赖于libc6
18.04 上没有的版本。
我没有尝试从源代码构建,因为如果可能的话我想避免这种情况。
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php7.4-fpm
结果是
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.
如果我特别查看 lib6c,我们会发现没有任何东西可以满足版本要求:
$ 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
答案1
这可能没什么帮助,但我能够在 Ubuntu 18.04LTS 上安装 php7.4-fpm,没有任何错误。我最初需要 php7.4 才能与 Matomo 一起使用。我使用了这篇文章在 Digital Ocean 上为 WordPress 在 Ubuntu 18.04 上更新至 PHP 7.4适用于我的设置。
从技术上讲,我并不需要 php7.4-fpm,但在看到这篇文章后,我决定测试一下。安装后没有报告任何问题。以下是我所拥有的:
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
以下是 php7.4-fpm 安装的完整报告:
$ 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.