3

I am running the Wordpress multisite click to deploy on the compute engine.

Operating system
    Debian 9.8 
Package contents
        Apache 2.4.25
        Google-Fluentd 1.6.9
        MySQL-Client 5.7.26
        MySQL-Server 5.7.26
        PHP 7.0.33
            Stackdriver-Agent 5.5.2
            WP-CLI 2.2.0
            WordPress 5.1.1
            phpMyAdmin 4.6.6

I would like to upgrade PHP to 7.3

1
  • Before upgrading PHP, make sure you read the docs and verify that the version you want to install is supported by your other applications and the OS. Often there are reasons you cannot thru supported methods. May 27, 2019 at 5:11

4 Answers 4

10

You can use a third-party repository to install php7.3

apt-get install ca-certificates apt-transport-https 
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list
apt-get update
apt-get install php7.3
4

You may follow this instructions on how to update your php version from 7.0 to 7.3.

For Debian:

$ 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

For Ubuntu:

$ sudo add-apt-repository ppa:ondrej/php # Press enter to confirm.

$ sudo apt-get update

$ sudo apt-get install php7.3

If you encounter the error below during installation, you may execute the command "$ sudo rm /var/lib/dpkg/lock" then try installing the php7.3 again.

E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)

E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?

Hope this information helps.

0

After updating your php version, the other thing you should do is:

update MYSQL and get WordPress to to recognize the new version

sudo apt-get update

sudo apt-get install php7.3-mysql

sudo a2enmod php7.3

sudo a2dismod php7.0

sudo systemctl restart apache2

0

This comprehensive instruction works just fine https://www.jiyuulife.net/update-php-version-for-wordpress-on-debian-9/

In the commands, replace the instruction's PHP version (7.4.5) with the latest release (7.4.11 as of October 2020).

In my case, after the update WordPress alerted me about missing (PHP) extensions that some plugins needed. I added them separately as per the instruction, restarted Apache and everything panned out perfectly fine.

Magic! Thanks Tang for the great instruction.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.