4

任何和所有 PHP 版本的持续错误 - 没有安装候选者。我已经运行了 apt-get update and upgrade / dist-upgrade 并在新的代码空间中添加了 sury repo。

vsonline:~/workspace$ sudo apt-get install php
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package php is a virtual package provided by:
  php7.4 7.4.6-1+0~20200514.17+debian9~1.gbp0f509e [Not candidate version]
  php7.3 7.3.18-1+0~20200515.59+debian9~1.gbp12fa4f [Not candidate version]
  php7.2 7.2.31-1+0~20200514.41+debian9~1.gbpe2a56b [Not candidate version]
  php7.1 7.1.33-16+0~20200514.38+debian9~1.gbp1e5820 [Not candidate version]
  php7.0 7.0.33-29+0~20200514.36+debian9~1.gbp126f6f [Not candidate version]
  php5.6 5.6.40-29+0~20200514.35+debian9~1.gbpcc49a4 [Not candidate version]
  php7.3 7.3.14-1~deb10u1 [Not candidate version]
  uwsgi-plugin-php 2.0.17.1+8+0.0.3+b3 [Not candidate version]
  php7.3 7.3.11-1~deb10u1 [Not candidate version]
  php7.0 7.0.33-0+deb9u7 [Not candidate version]
  php7.0 7.0.33-0+deb9u6 [Not candidate version]

E: Package 'php' has no installation candidate
4

1 回答 1

1

我也有同样的头痛,但我决定手动安装

利用:

wget https://www.php.net/distributions/php-7.4.9.tar.gz
#Or the version of your preference

解压并安装

tar zxf php-x.x.x
cd ../php-x.x.x
./configure --enable-fpm --with-mysqli
make
sudo make install

获取配置文件并将其移动到正确的位置

cp php.ini-development /usr/local/php/php.ini
cp /usr/local/etc/php-fpm.d/www.conf.default /usr/local/etc/php-fpm.d/www.conf
cp sapi/fpm/php-fpm /usr/local/bin

来源:官方文档 链接下载php

或者,如果您更喜欢使用 Docker,我推荐 laradock,它可以让工作更轻松。我最终使用了它,Doc 非常简单Laradock DOC

于 2020-09-01T11:07:38.543 回答