First of all, I’d like to thank for all your questions and feedback we’ve got so far regarding our Ask Paulie Anything project. 🙂
Today We’re Discussing Which Versions Of PHP Are Best For WordPress
I get a quite number of questions about PHP versions and different settings that you can set to manage PHP.
Today, we’re going to discuss what version of PHP is best to run for WordPress, but you’ll also learn a strategy on how to upgrade your website PHP from 5.2 to PHP 7.0 in a way that’s not likely to break your site.
So, the question is:
Which PHP version is best for WordPress and what minimal extensions one must select in PHP Selector for optimal working and speed of the WordPress website?
This is a two-part question:
- PHP Selector; and
- PHP version and what’s best for WordPress.
0:38 – PHP Selector
I’m assuming the PHP Selector in this question is something like cPanel’s EasyApache configuration. I think these things come with “default” selections for PHP extensions.
Unless you know what you’re doing, and unless you have a good reason to do otherwise, leave the defaults exactly as they are. If there’s a plugin that needs a particular extension for PHP and you haven’t compiled that, with cPanel EasyApache that’s very easy to do after the fact.
So, my advice is:
Leave everything at defaults unless you have a very good reason not to, and unless you understand what you’re doing.
1:21 – What Version Of PHP Is Best To Run For WordPress?
People might tell you that you must be on the latest version of PHP (7.2 at the time of writing) and that you must update as soon as updates come out… all that great stuff which isn’t very practical for most people. But, generally, the higher version of PHP you’re on, the better.
If you’re running PHP 5.2 for example, which is over 10 years old at this stage, then you really need to take steps as soon as possible to move from that.
Important: If you’re on the web host that does not make it easy for you to upgrade to at least PHP 7.0, move to another web host. You should always be on a web host that is at least good enough to allow you the option to upgrade your PHP.
So, when you’re choosing your PHP version what you want to do is strike a balance between compatibility on your site and running the latest version of PHP that you can.
2:23 – How To Safely Upgrade Your WordPress’ PHP
We’re going to offer a safe approach and guidance on how to upgrade your WordPress PHP to PHP 7.0 and above in a way that’s not likely to break your site.
Let’s take for example that you’re on PHP 5.2.
It’s not a good idea to jump into your web hosting control panel and switch to PHP 7.0. If you want to break your site, that’s probably the best way to do it.
What I would advise to get as high a version as you can is to stair-step it.
Rather than go straight from 5.2 to 7.0, go from 5.2 to 5.3. If you’re happy with that, move on to the next version of PHP – 5.4.
The point is to bring you slowly up to the point where you can run the latest version of PHP without breaking your website.
So, if you’re on PHP 5.2, follow these steps:
- Turn on the PHP 5.3
- Leave it for a few weeks (even for a month) and test everything
- Once you’re happy with it, move on to the next level (5.4) and repeat the Step 2
- If you get errors or notices, take a very clear note of those errors or notices and give them to the plugin developers, depending on where those errors happen. Hopefully, they can sort it out.
3:47 – You don’t need to run WordPress on the absolute latest version of PHP
Recently, WordPress.org said that the recommended version for WordPress is PHP 7.2… But, I would advise against going all the way up to PHP 7.2.
If you’re running PHP 7.1 and have been doing so for a long time, then perhaps yes, test PHP 7.2.
But, if you’re happy enough, you could stay at 7.1 for a while. 7.2 is new, and those running 7.2 and above is still tiny.
Just get as high as you can (ideally 7.1) and leave it, be comfortable with that. But, don’t feel you have to go to the greatest and latest.
Thank You! Comments, Questions?
Hope that helps with PHP versions.
If you want to send your own question, please feel free to do so by using the link below. You can ask anything you want and I’ll do my best to get your question answered. 🙂