skip to Main Content

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

4

Answers


  1. 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
    
    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
  3. 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

    Login or Signup to reply.
  4. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search