I get it…
...changing your PHP version in WordPress can be daunting.
The errors that crop up can leave you feeling confused.
Often simple tips and tricks…
Like clearing your cache and overcoming compatibility issues. To make the process smoother.
When it comes to WordPress, you’ll need to make sure that you’ve updated the latest version of all of your plugins and theme. Because often this can throw rocks on your path.
In this article, we’ll explore the in’s and out’s of how to update your PHP version on WordPress. Plus common issues that can be easily avoided (when you know the issues that can arise).
Upgrading your PHP version is a great idea, plus it’s pretty straightforward. Especially if you get it right the first time.
Firstly, let’s look into a commonly asked question:
1. Will Upgrading PHP Break Your WordPress Website?
Best for - people who already use Elementor to design their WP pages.
The current PHP version is 7.4.5 and was released on 16 April 2020. Upgrading to the latest version is a wise move so that you can take advantage of all of the latest features. Your site will increase in performance. Additionally PHP 7.3 (or grater) is the officially recommended PHP version for WordPress.
If you’re on an old PHP version, it’s understandable that you’d want to get things up to speed.
So will upgrading your site break it?
The answer is – if you don’t perform the upgrade properly, then your site could break. For that reason please read through all of this article and take all of the simple precautions necessary.
2. Managed Hosting vs Dedicated Server
If you have full privileges and run a dedicated server – you can update your PHP version directly via the command line. However, if you have a managed hosting account, you’ll most likely need to get in touch with your support team to ask them to help you out with the upgrade.
Some hosting companies, for example, InMotion allow you to easily switch your PHP version.
3. Four Steps to Safely Upgrade Your PHP Version
Step #1 Take a Backup
Taking backups is always the first step that you take before altering your site. YOu might have backups that you’ve taken recently. But taking backups right before changing your site, is always the best protocol.
Go ahead and take a backup now.
That way if you mess up, you can simply fall back on your backed-up version of your site.
If you don’t know how to backup your WordPress website then check out our full guide here.
PRO TIP: Make sure to backup all sections of your website – uploads, themes, plugins & database.
Step #2 Create a Local Copy of Your WordPress Website
If you want the easiest non-techy approach to creating a local copy of your WordPress website, then you’ll want to download a local WordPress development tool like “Local” by Flywheel. It’s not only easy to use, but it’s also free and comes with some great instructional videos.
You can also show your local site easily by clicking on the share link feature.
All you have to do to set up a local version of your site is:
1. Download and install Local. Make sure to choose your local environment platform. From Mac, Windows, or Linux.
2. Input your WordPress username, password, and email in the fields shown below
3. Click the “ADD SITE” button on the bottom right-hand corner of your screen as follows
4. Visit Local Site
Viewing your local site is quick and easy. All you have to do is click on your website repository in Local and then when you are in your site listing simply click on “view site” on the top right, as shown below:
Step #3 Check Your Plugins & Local Website
Next, you’ll want to check that your plugins are working properly. To do this, set up a copy of your site and test how everything works when the latest version of PHP is deployed.
If any of your plugins are no longer working. Then now is a good time to look for alternative solutions for that particular feature.
You’ll want to go through each of the pages on your website carefully to make sure that they’re functioning as they should. Your local website should be a direct copy of your website and should act exactly as your live website did.
If you find any broken aspects of your website, then change plugins or upgrade your theme as required.
Once you are happy that your local website is working properly, then it’s time to port it over to your live website.
PRO TIP: Never miss out the backup or local copy of your website steps. These steps are essential to make sure that you upgrade your website’s PHP in the most efficient way.
Step #4 Upgrade Your Live WordPress Website
Once you are happy that your staging website is ready and working as you’d like…
… it’s time to upgrade your website for real this time.
There are three main approaches to upgrading your live website.
1. Ask Your Host – If you have a managed server, ask your host to upgrade your WordPress website to the latest version of PHP.
2. Upgrade with Command Line – If you have a VPS or dedicated server with full privileges you can easily upgrade PHP from the command line. This is the most technical approach:
- REMOVE THE CURRENT PHP VERSION (using Apache)
Press y and hit Enter
sudo yum remove php-cli mod_php php-common
- INSTALL THE NEW PHP VERSION (from IUS)
Press y and Enter when prompted.
sudo yum install mod_php70u php70u-cli php70u-mysqlnd
- Restart Apache to load the new version of mod_php:
sudo apachectl restart
3. Upgrade with cPanel – You can upgrade your PHP version with cPanel. By following these simple steps
- Login to cPanel
- Go to the software section and click PHP configuration (in my cPanel it’s called the MultiPHP Manager) section as shown below
- Chose your new PHP version from the drop-down menu as follows:
4. Final Thoughts
If you follow the steps above. Namely backing up your website, making a local copy and testing, and then finally upgrading your site to the latest version of PHP. Then you’ll be in safe territory. If you miss out on any of the steps, then you could be in for a lot of struggles. This guide is intended to provide you the safest and easiest method of upgrading your PHP version in WordPress.