Updated to PHP7 for WP, but still complaining of being on 5.9?

April 12, 2017 471 views
PHP WordPress Ubuntu

Hello. I updated my server to PHP7 for use with WordPress. php -v shows it installed correctly, but WP is still complaining it's on PHP5.9. From my research, this is because it's not pointing to the correct instance of PHP. I can't figure out how to adjust this, and I've tried following the upgrade guide step by step several times, to no avail. Any help?

4 Answers


By running apt-get remove php5 you're not removing the previous Apache module.

I would simply remove PHP 5 altogether if you don't need it, which can be done by running:

apt-get -y remove php5*

and to purge the configuration:

apt-get -y purge php5*

Once you're done there, I would run:

apt-get -y remove libapache2-mod-php5.x

Where the 5.x is the version of PHP 5 that you installed.

Once you've removed PHP 5.x, then you can run:

apt-cache search php7.0

... to find any/all packages available for PHP 7.0. You need to install the module as I noted in my previous post, and then any associated packages that you may need.

There is no PHP 5.9. Did you restart your webserver?

Sorry, I meant 5.59, my mistake. Yes, I restarted the server and Apache, and neither of those reflected the change. Basically the process I did was:

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.0
sudo apt-get install php7.0-mysql
sudo reboot


When it comes to apache, you need to install libapache2-mod-php7.0 as mod_php is what Apache uses to handle PHP requests.

When you run php -v from the command line (CLI), you're using the CLI version of PHP, not the same version that Apache is using. Installing the package above should fix the issue, though you need to remove the current package (for PHP 5.x) first.

  • Thanks much, @jtittle, that unfortunately didn't seem to do the trick. Went through all of the above procedure from scratch, then did:

    sudo apt-get install libapache2-mod-php7.0
    sudo reboot
    sudo apt-get remove php5
    sudo reboot

    And same error... "The minimum PHP version required for this plugin is 5.6.0. You are running 5.5.9-1ubuntu4.17."

    • Three things I would check:

      • Any override options in .htaccess/php.ini in your app folder.
      • Run phpinfo(); in a fresh file and look at where things are configured to.
      • Run dpkg-query -l '*php*' and see what PHP options are installed, remove what you're not using.
Have another answer? Share your knowledge.