我已经使用 Google Cloud Platform (GCP) 一段时间了,现在我的大多数 WordPress 网站都出现错误,我需要更新我的 PHP我用了$ sudo apt install apt-transport-https lsb-release$ sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg # Download the signing key$ sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' # Add Ondrej's repo to sources list.$ sudo apt update$ sudo apt-get install php7.3To check the current version after the installation:$ php -v它有效现在$ php -v显示这个 PHP 7.3.20-1+0~20200710.65+debian9~1.gbpc9cbeb (cli) (built: Jul 10 2020 07:22:47) ( NTS )Copyright (c) 1997-2018 The PHP GroupZend Engine v3.3.20, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.3.20-1+0~20200710.65+debian9~1.gbpc9cbeb, Copyright (c) 1999-2018, by Zend Technologies但是当我去我的WordPress时它仍然显示给我Running PHP version: 7.0.33-29+0~20200514.36+debian9~1.gbp126f6f我尝试了多种方法,但没有任何效果,例如sudo update-alternatives --set php /usr/bin/php7.3wp --info现在它显示为OS: Linux 4.9.0-12-amd64 #1 SMP Debian 4.9.210-1+deb9u1 (2020-06-07) x86_64Shell: /bin/bashPHP binary: /usr/bin/php7.3PHP version: 7.3.20-1+0~20200710.65+debian9~1.gbpc9cbebphp.ini used: /etc/php/7.3/cli/php.iniWP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cliWP-CLI vendor dir: phar://wp-cli.phar/vendorWP_CLI phar path: /home/malriffaieWP-CLI packages dir:WP-CLI global config:WP-CLI project config:WP-CLI version: 2.4.0wordpress 仍然有同样的问题,我该怎么办?
1 回答
aluckdog
TA贡献1847条经验 获得超7个赞
您似乎安装了两个 PHP 版本:7.0 和 7.3。您可以检查:
$ php -v PHP 7.3.20... $ which php /usr/bin/php $ ls -l /usr/bin/php* lrwxrwxrwx 1 21 May 13 09:02 /usr/bin/php -> /etc/alternatives/php -rwxr-xr-x 1 4389936 May 14 09:11 /usr/bin/php7.0 -rwxr-xr-x 1 4708288 Jul 10 07:22 /usr/bin/php7.3 lrwxrwxrwx 1 25 May 13 09:02 /usr/bin/php-cgi -> /etc/alternatives/php-cgi -rwxr-xr-x 1 4283768 May 14 09:11 /usr/bin/php-cgi7.0
如果目标是升级 PHP,但不是并行使用不同版本,则应删除以前的 PHP 版本,如下所述:
Debian 9 - 升级到 PHP 7.3
- 1 回答
- 0 关注
- 95 浏览
添加回答
举报
0/150
提交
取消