在 Ubuntu 19.04 上安装 PHP 7.4 时出错

在 Ubuntu 19.04 上安装 PHP 7.4 时出错

我正在尝试通过 ondrej/php repo 在 Ubuntu 19.04 上安装 PHP 7.4。但是,我收到一个错误:Unable to locate package php7.4

终端按命令顺序输出:

apt update && apt upgrade

Hit:1 http://ppa.launchpad.net/ondrej/php/ubuntu disco InRelease
Hit:2 http://security.ubuntu.com/ubuntu disco-security InRelease
Hit:3 http://us.archive.ubuntu.com/ubuntu disco InRelease
Hit:4 http://us.archive.ubuntu.com/ubuntu disco-updates InRelease
Get:5 http://us.archive.ubuntu.com/ubuntu disco-backports InRelease [88.8 kB]
Fetched 88.8 kB in 1s (97.9 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
3 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
linux-headers-5.0.0-38 linux-headers-5.0.0-38-generic linux-image-5.0.0-38-generic linux-modules-5.0.0-38-generic linux-modules-extra-5.0.0-38-generic
The following packages will be upgraded:
linux-generic linux-headers-generic linux-image-generic
3 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 67.8 MB of archives.
After this operation, 336 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu disco-updates/main amd64 linux-modules-5.0.0-38-generic amd64 5.0.0-38.41 [13.9 MB]
Get:2 http://us.archive.ubuntu.com/ubuntu disco-updates/main amd64 linux-image-5.0.0-38-generic amd64 5.0.0-38.41 [8,445 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu disco-updates/main amd64 linux-modules-extra-5.0.0-38-generic amd64 5.0.0-38.41 [33.4 MB]
Get:4 http://us.archive.ubuntu.com/ubuntu disco-updates/main amd64 linux-generic amd64 5.0.0.38.40 [1,864 B]
Get:5 http://us.archive.ubuntu.com/ubuntu disco-updates/main amd64 linux-image-generic amd64 5.0.0.38.40 [2,424 B]
Get:6 http://us.archive.ubuntu.com/ubuntu disco-updates/main amd64 linux-headers-5.0.0-38 all 5.0.0-38.41 [10.8 MB]
Get:7 http://us.archive.ubuntu.com/ubuntu disco-updates/main amd64 linux-headers-5.0.0-38-generic amd64 5.0.0-38.41 [1,243 kB]
Get:8 http://us.archive.ubuntu.com/ubuntu disco-updates/main amd64 linux-headers-generic amd64 5.0.0.38.40 [2,380 B]
Fetched 67.8 MB in 5s (12.5 MB/s)
Selecting previously unselected package linux-modules-5.0.0-38-generic.
(Reading database ... 65097 files and directories currently installed.)
Preparing to unpack .../0-linux-modules-5.0.0-38-generic_5.0.0-38.41_amd64.deb ...
Unpacking linux-modules-5.0.0-38-generic (5.0.0-38.41) ...
Selecting previously unselected package linux-image-5.0.0-38-generic.
Preparing to unpack .../1-linux-image-5.0.0-38-generic_5.0.0-38.41_amd64.deb ...
Unpacking linux-image-5.0.0-38-generic (5.0.0-38.41) ...
Selecting previously unselected package linux-modules-extra-5.0.0-38-generic.
Preparing to unpack .../2-linux-modules-extra-5.0.0-38-generic_5.0.0-38.41_amd64.deb ...
Unpacking linux-modules-extra-5.0.0-38-generic (5.0.0-38.41) ...
Preparing to unpack .../3-linux-generic_5.0.0.38.40_amd64.deb ...
Unpacking linux-generic (5.0.0.38.40) over (5.0.0.13.14) ...
Preparing to unpack .../4-linux-image-generic_5.0.0.38.40_amd64.deb ...
Unpacking linux-image-generic (5.0.0.38.40) over (5.0.0.13.14) ...
Selecting previously unselected package linux-headers-5.0.0-38.
Preparing to unpack .../5-linux-headers-5.0.0-38_5.0.0-38.41_all.deb ...
Unpacking linux-headers-5.0.0-38 (5.0.0-38.41) ...
Selecting previously unselected package linux-headers-5.0.0-38-generic.
Preparing to unpack .../6-linux-headers-5.0.0-38-generic_5.0.0-38.41_amd64.deb ...
Unpacking linux-headers-5.0.0-38-generic (5.0.0-38.41) ...
Preparing to unpack .../7-linux-headers-generic_5.0.0.38.40_amd64.deb ...
Unpacking linux-headers-generic (5.0.0.38.40) over (5.0.0.13.14) ...
Setting up linux-modules-5.0.0-38-generic (5.0.0-38.41) ...
Setting up linux-headers-5.0.0-38 (5.0.0-38.41) ...
Setting up linux-image-5.0.0-38-generic (5.0.0-38.41) ...
I: /vmlinuz.old is now a symlink to boot/vmlinuz-5.0.0-13-generic
I: /initrd.img.old is now a symlink to boot/initrd.img-5.0.0-13-generic
I: /vmlinuz is now a symlink to boot/vmlinuz-5.0.0-38-generic
I: /initrd.img is now a symlink to boot/initrd.img-5.0.0-38-generic
Setting up linux-headers-5.0.0-38-generic (5.0.0-38.41) ...
Setting up linux-modules-extra-5.0.0-38-generic (5.0.0-38.41) ...
Setting up linux-headers-generic (5.0.0.38.40) ...
Setting up linux-image-generic (5.0.0.38.40) ...
Setting up linux-generic (5.0.0.38.40) ...
Processing triggers for linux-image-5.0.0-38-generic (5.0.0-38.41) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.0.0-38-generic
/etc/kernel/postinst.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.0.0-38-generic
Found initrd image: /boot/initrd.img-5.0.0-38-generic
Found linux image: /boot/vmlinuz-5.0.0-13-generic
Found initrd image: /boot/initrd.img-5.0.0-13-generic
Found linux image: /boot/vmlinuz-4.15.0-22-generic
Found initrd image: /boot/initrd.img-4.15.0-22-generic
done

LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php

LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
Co-installable PHP versions: PHP 5.6, PHP 7.x and most requested extensions are included. Only Supported Versions of PHP (http://php.net/supported-versions.php) for Supported Ubuntu Releases (https://wiki.ubuntu.com/Releases) are provided. Don't ask for end-of-life PHP versions or Ubuntu release, they won't be provided.

Debian oldstable and stable packages are provided as well: https://deb.sury.org/#debian-dpa

You can get more information about the packages at https://deb.sury.org

BUGS&FEATURES: This PPA now has a issue tracker:
https://deb.sury.org/#bug-reporting

CAVEATS:
1. If you are using php-gearman, you need to add ppa:ondrej/pkg-gearman
2. If you are using apache2, you are advised to add ppa:ondrej/apache2
3. If you are using nginx, you are advise to add ppa:ondrej/nginx-mainline
   or ppa:ondrej/nginx

PLEASE READ: If you like my work and want to give me a little motivation, please consider donating regularly: https://donate.sury.org/

WARNING: add-apt-repository is broken with non-UTF-8 locales, see
https://github.com/oerdnj/deb.sury.org/issues/56 for workaround:

# LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
More info: https://launchpad.net/~ondrej/+archive/ubuntu/php
Press [ENTER] to continue or Ctrl-c to cancel adding it.

Hit:1 http://ppa.launchpad.net/ondrej/php/ubuntu disco InRelease
Hit:2 http://security.ubuntu.com/ubuntu disco-security InRelease
Hit:3 http://us.archive.ubuntu.com/ubuntu disco InRelease
Hit:4 http://us.archive.ubuntu.com/ubuntu disco-updates InRelease
Get:5 http://us.archive.ubuntu.com/ubuntu disco-backports InRelease [88.8 kB]
Fetched 88.8 kB in 1s (101 kB/s)
Reading package lists... Done

apt update

Hit:1 http://ppa.launchpad.net/ondrej/php/ubuntu disco InRelease
Hit:2 http://security.ubuntu.com/ubuntu disco-security InRelease
Hit:3 http://us.archive.ubuntu.com/ubuntu disco InRelease
Hit:4 http://us.archive.ubuntu.com/ubuntu disco-updates InRelease
Get:5 http://us.archive.ubuntu.com/ubuntu disco-backports InRelease [88.8 kB]
Fetched 88.8 kB in 1s (99.9 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.

apt install php7.4

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'

在添加 repo、更新或其他任何操作过程中,我没有看到任何错误(除非安装 PHP 7.4

我可以从源代码编译它,但这很麻烦,所以我宁愿不这样做。

答案1

https://launchpad.net/%7Eondrej/+archive/ubuntu/php/+index?batch=75&memo=150&start=150列表

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)

因此没有适用于 19.04 的软件包...

存储库数据http://ppa.launchpad.net/ondrej/php/ubuntu/dists/disco/main/binary-amd64/Packages.gz也是空的......

相关内容