Report this

What is the reason for this report?

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

Posted on April 12, 2017

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?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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

@mattf855f07e854

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.

@mattf855f07e854

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.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.