Question

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

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?


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

@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.

@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.

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