即使在apache2中使用OndrejPPA存储库,也无法在Ubuntu16.04上安装PHP7.4
我正在尝试在 Ubuntu 16.04 上为 Apache2 服务器安装 PHP 7.4。为了安装 7.4 版本,我使用了 PPA ondrej 存储库,如下所示:
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install -y php7.4
php -v
我收到以下错误:
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'
我尝试了回答这个问题时提到的所有解决方案:
无法在 Ubuntu 20.04 上安装 PHP 7.3
他们都没有帮助。我怎样才能安装这个包?
回答
您的操作系统 Ubuntu 16.04 (Xenial) 太旧了。Ondrej PPA 仅支持以下操作系统(截至 2021 年 6 月 10 日):
Hirsute (21.04)、Groovy (20.10)、Focal (20.04)、Bionic (18.04)
这就是为什么没有找到包的原因。
- Yes as said, your Operating system is not supported anymore. Ondrej PPA supports only versions of Ubuntu (and php) which are still supported. Standard Support for 16.04 ran out in April 2021, since then you probably did not get any php7.3 updates (Which by the way also runs out of support soon). You won't be able to install it via ondrej ppa again. But since your OS is outdated and out of support you really should update it. After updating your os to at least 18.04 you should be fine installing any php version >= 7.3
-
@Tobias you livesafer. I tested this out on different machines running 16.04 and none of them could find any PHP packages.
After spending an entire day I stumbled upon this post. Thanks dude.
回答
您可以通过将此 3rd 方存储库添加到您的系统来存档:
sudo add-apt-repository ppa:jczaplicki/xenial-php74-temp
sudo apt-get update
警告:
这是向您的系统添加外部 PPA 存储库。如果您不信任维护者,则不应这样做,因为它可能会暴露您的系统。另请注意,这可能适用于安装 php,但不能保证您通过它接收更新(存储库名称中的“temp”一词表示这只是暂时的)。如果您确实需要在 16.04 上安装它,我宁愿建议您自己编译它。
作为“长期解决方案”,您确实应该更新您的系统。
THE END
二维码