skip to Main Content

I have been trying to update PHP on my install of WordPress on Google Cloud.
I have followed these instructions: How do I upgrade from PHP 7.0 to 7.3 on google cloud platform?.
When I do a php -v command, it shows that it is updated, but within WordPress it is still showing version 7.0, not the updated version.

2

Answers


  1. Your system appears to have two installations of PHP. One for the CLI and another Apache or you have not restarted Apache after the update. First restart Apache and recheck.

    The command to install Apache PHP is sudo apt install libapache2-mod-php7.3.

    Warning: Be careful with manual updates of PHP and other software that may have interdependencies. Make sure you have backed up your system (image) before so that you can recover is something goes wrong. Debian 4.9 is very old (obsolete) and might not be supported or even tested with the latest versions of third-party software.

    The Linux command where php will tell you where PHP is installed. To figure out if you have a different installation for Apache, create a new web page, such as myphpinfo.php with the following contents. Then use your browser to view the page:

    <?php
    
    // Show all information, defaults to INFO_ALL
    phpinfo();
    
    ?>
    

    Your browser will display a page like this:

    enter image description here

    Login or Signup to reply.
  2. Use SSH commands:
    Go to root

    sudo -i
    

    install latest version of php

    apt-get install php7.4
    

    update it

    apt-get update
    

    install packages

    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
    

    check your php version

    php -v
    

    enable php7.4 and disable your current php7.0

    sudo a2dismod php7.0
    sudo a2enmod php7.4
    

    install the libraries

    sudo apt-get install phpmyadmin php-mbstring php-gettext
    sudo apt-get install php-mysql
    sudo apt-get install php-curl
    sudo apt-get install php-xml
    sudo apt-get install php-gd
    

    restart apache

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