我使用的是 Ubuntu 14.04 和 PHP 7.0。我需要将 PHP 更新到 PHP 7.4。我添加了ppa:ondrej/php
存储库。尽管如此,它还是Unable to locate package php7.4
在尝试更新 PHP 时说。
$ sudo 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
IMPORTANT: The <foo>-backports is now required on older Ubuntu releases.
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 advised 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
gpg: keyring `/tmp/tmpayt67sik/secring.gpg' created
gpg: keyring `/tmp/tmpayt67sik/pubring.gpg' created
gpg: requesting key E5267A6C from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpayt67sik/trustdb.gpg: trustdb created
gpg: key E5267A6C: public key "Launchpad PPA for Ondřej Surý" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
OK
$ sudo apt update
Ign http://ap-southeast-1.ec2.archive.ubuntu.com trusty InRelease
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty-updates InRelease
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty-backports InRelease
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty Release.gpg
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty Release
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty-updates/main Sources
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty-updates/restricted Sources
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty-updates/universe Sources
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty-updates/multiverse Sources
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty-updates/main amd64 Packages
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty-updates/restricted amd64 Packages
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty-updates/universe amd64 Packages
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty-updates/multiverse amd64 Packages
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty-updates/main Translation-en
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty-updates/multiverse Translation-en
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty-updates/restricted Translation-en
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty-updates/universe Translation-en
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty-backports/main Sources
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty-backports/restricted Sources
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty-backports/universe Sources
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty-backports/multiverse Sources
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty-backports/main amd64 Packages
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty-backports/restricted amd64 Packages
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty-backports/universe amd64 Packages
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty-backports/multiverse amd64 Packages
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty-backports/main Translation-en
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty-backports/multiverse Translation-en
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty-backports/restricted Translation-en
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty-backports/universe Translation-en
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty/main Sources
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty/restricted Sources
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty/universe Sources
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty/multiverse Sources
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty/main amd64 Packages
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty/restricted amd64 Packages
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty/multiverse amd64 Packages
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty/main Translation-en
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty/multiverse Translation-en
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty/restricted Translation-en
Hit http://ap-southeast-1.ec2.archive.ubuntu.com trusty/universe Translation-en
Ign http://ap-southeast-1.ec2.archive.ubuntu.com trusty/main Translation-en_US
Ign http://ap-southeast-1.ec2.archive.ubuntu.com trusty/multiverse Translation-en_US
Ign http://ap-southeast-1.ec2.archive.ubuntu.com trusty/restricted Translation-en_US
Ign http://ap-southeast-1.ec2.archive.ubuntu.com trusty/universe Translation-en_US
Hit http://ppa.launchpad.net trusty InRelease
Hit http://security.ubuntu.com trusty-security InRelease
Hit http://security.ubuntu.com trusty-security/main Sources
Hit http://ppa.launchpad.net trusty/main amd64 Packages
Hit http://security.ubuntu.com trusty-security/universe Sources
Hit http://ppa.launchpad.net trusty/main Translation-en
Hit http://security.ubuntu.com trusty-security/main amd64 Packages
Hit http://security.ubuntu.com trusty-security/universe amd64 Packages
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Reading package lists... Done
$ sudo apt install php7.4
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 regex 'php7.4'
此问题的原因是什么以及如何在 Ubuntu 14.04 上安装 PHP 7.4?
答案1
从存储库描述:
仅支持的 PHP 版本(http://php.net/supported-versions.php) 对于支持的 Ubuntu 版本 (https://wiki.ubuntu.com/Releases)提供。不要要求终止生命的 PHP 版本或 Ubuntu 版本,它们不会提供。
Ubuntu 14.04 支持于 2019 年 4 月结束,因此存储库不包含 14.04 的软件包,并且您无法安装 php 7.4。我不知道旧 Ubuntu 版本有任何其他新 PHP 来源,因此您可能需要手动安装它或升级到较新的、受支持的 Ubuntu 版本。