我知道这个问题已经被问过很多次了,但是我总是得到相同的答案,而这并不能解决我的问题。
提供的解决方案通常是这样的:
~$ sudo apt-get install software-properties-common python-software-properties;
~$ sudo add-apt-repository -y ppa:ondrej/php;
~$ sudo apt-get update;
大功告成!但不幸的是,我的情况并非如此。
因此,执行前面提到的步骤后,我尝试通过安装“任何”PHP 7.x 版本,apt
但似乎找不到任何版本的 PHP 的软件包。
~$ sudo apt install php7.4;
Reading package lists... Done
Building dependency tree... 50%
Building dependency tree
Reading state information... Done
Note, selecting 'php7.4-gd' for regex 'php7.4'
Note, selecting 'php7.4-cli' for regex 'php7.4'
Note, selecting 'php7.4-dom' for regex 'php7.4'
Note, selecting 'php7.4-ffi' for regex 'php7.4'
Note, selecting 'php7.4-ftp' for regex 'php7.4'
Note, selecting 'php7.4-xmlreader' for regex 'php7.4'
Note, selecting 'php7.4-mysqli' for regex 'php7.4'
Note, selecting 'php7.4-sysvmsg' for regex 'php7.4'
Note, selecting 'php7.4-json' for regex 'php7.4'
Note, selecting 'php7.4-phar' for regex 'php7.4'
Note, selecting 'php7.4-tokenizer' for regex 'php7.4'
Note, selecting 'php7.4-curl' for regex 'php7.4'
Note, selecting 'php7.4-shmop' for regex 'php7.4'
Note, selecting 'php7.4-pdo-mysql' for regex 'php7.4'
Note, selecting 'php7.4-sysvsem' for regex 'php7.4'
Note, selecting 'php7.4-sysvshm' for regex 'php7.4'
Note, selecting 'php7.4-pdo' for regex 'php7.4'
Note, selecting 'php7.4-sockets' for regex 'php7.4'
Note, selecting 'php7.4-ctype' for regex 'php7.4'
Note, selecting 'php7.4-calendar' for regex 'php7.4'
Note, selecting 'php7.4-intl' for regex 'php7.4'
Note, selecting 'php7.4-fileinfo' for regex 'php7.4'
Note, selecting 'php7.4-opcache' for regex 'php7.4'
Note, selecting 'php7.4-soap' for regex 'php7.4'
Note, selecting 'php7.4-xml' for regex 'php7.4'
Note, selecting 'php7.4-xsl' for regex 'php7.4'
Note, selecting 'php7.4-zip' for regex 'php7.4'
Note, selecting 'php7.4-simplexml' for regex 'php7.4'
Note, selecting 'php7.4-mysql' for regex 'php7.4'
Note, selecting 'php7.4-mbstring' for regex 'php7.4'
Note, selecting 'php7.4-readline' for regex 'php7.4'
Note, selecting 'php7.4-exif' for regex 'php7.4'
Note, selecting 'php7.4-mysqlnd' for regex 'php7.4'
Note, selecting 'php7.4-common' for regex 'php7.4'
Note, selecting 'php7.4-bcmath' for regex 'php7.4'
Note, selecting 'php7.4-posix' for regex 'php7.4'
Note, selecting 'php7.4-iconv' for regex 'php7.4'
Note, selecting 'libapache2-mod-php7.4' for regex 'php7.4'
Note, selecting 'php7.4-gettext' for regex 'php7.4'
Note, selecting 'php7.4-xmlwriter' for regex 'php7.4'
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
同样有趣的是,当我使用时,apt search
似乎没有任何php
版本的软件包
~$ sudo apt search php7.4
Sorting... Done
Full Text Search... Done
libapache2-mod-php7.4/now 7.4.13-1+ubuntu16.04.1+deb.sury.org+1 amd64 [residual-config]
(none)
php7.4-bcmath/now 7.4.13-1+ubuntu16.04.1+deb.sury.org+1 amd64 [residual-config]
(none)
php7.4-cli/now 7.4.13-1+ubuntu16.04.1+deb.sury.org+1 amd64 [residual-config]
(none)
php7.4-common/now 7.4.13-1+ubuntu16.04.1+deb.sury.org+1 amd64 [residual-config]
(none)
php7.4-curl/now 7.4.13-1+ubuntu16.04.1+deb.sury.org+1 amd64 [residual-config]
(none)
php7.4-gd/now 7.4.13-1+ubuntu16.04.1+deb.sury.org+1 amd64 [residual-config]
(none)
php7.4-intl/now 7.4.13-1+ubuntu16.04.1+deb.sury.org+1 amd64 [residual-config]
(none)
php7.4-json/now 7.4.13-1+ubuntu16.04.1+deb.sury.org+1 amd64 [residual-config]
(none)
... etc
我错过了什么?
编辑:执行后apt-get purge php7.4
消息(至少 PHP 7.4)已更改为以下内容:
~$ sudo apt-get install -y 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 glob 'php7.4'
E: Couldn't find any package by regex 'php7.4'
答案1
对于任何感兴趣的人;
自 2021-06-10 起,Ubuntu xenial 16.04 不再支持 PHP。当我尝试在其他使用 16.04 的 VM 上安装 PHP 模块/版本时,我发现了这个问题,显然“找不到软件包”,而其他机器之前已经轻松安装了它们。
stackoverflow 上有一篇文章描述了这一点:https://stackoverflow.com/questions/67920506/unable-to-install-php-7-4-on-ubantu-16-04-even-with-ondrej-ppa-repository-in-apa