i have been using Google Cloud Platform (GCP) for a while, and now im getting error in most of my wordpress sites, that i need to update my PHP
i used
$ 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.3
To check the current version after the installation:
$ php -v
and it works
now
$ php -v
Shows this
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 Group
Zend 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
But when i go to my wordpress it still show me
Running PHP version: 7.0.33-29+0~20200514.36+debian9~1.gbp126f6f
i tried multiple things and nothing is working, such as
sudo update-alternatives --set php /usr/bin/php7.3
wp --info
and now it shows as
OS: Linux 4.9.0-12-amd64 #1 SMP Debian 4.9.210-1+deb9u1 (2020-06-07) x86_64
Shell: /bin/bash
PHP binary: /usr/bin/php7.3
PHP version: 7.3.20-1+0~20200710.65+debian9~1.gbpc9cbeb
php.ini used: /etc/php/7.3/cli/php.ini
WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir: phar://wp-cli.phar/vendor
WP_CLI phar path: /home/malriffaie
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.4.0
still same issue on wordpress, what should i do?
It seems you've got two PHP versions installed: 7.0 and 7.3. You can check that:
$ 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
If the goal was to upgrade PHP, but not to use different versions in parallel, you should remove the previous PHP version as described here:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.