PHP Security

How To Update PHP Version in WordPress

Updated on: February 14, 2022

How To Update PHP Version in WordPress

WordPress relies heavily on PHP. Most of the core files and almost all themes in WordPress are PHP based. PHP is so widely used over the internet today that even the blog you are reading is powered by PHP. Having the latest version of PHP on your website can give you a significant edge over the people who run outdated versions. There are many reasons why you should update to the latest version of PHP. In this blog, we will explain why and how to update your WordPress site to the latest version of PHP.

Why You Should Update to Latest PHP Version

Better Performance

The current latest version of PHP is 8.x. Once you update your website to PHP 8.x you will find that it is more speedy as compared to your previous version. When compared with PHP 5.6, PHP 8 is known to enhance site performance by more than fifty percent. Moreover, PHP 8 uses lesser memory and many fatal errors of the previous version have been taken care of in this version.

Security

The latest PHP version contains bug fixes and added security features. Therefore, updating your site to the latest PHP version gives you an additional element of security from hackers at no extra cost.
Windows 64-bit Support

PHP 8 has added consistent support for Windows 64 bit systems. Therefore, if you are a windows person, the update is just meant for you.

Better SEO

Once you update to latest PHP version, the increase in your website performance would mean that search engines would rank your website higher. Moreover, it will also decrease the bounce rate as users will not leave the site due to the slow rendering of the content.

How to Update PHP Version

Before you update the PHP version there are some prerequisites you need to follow,

Backup

The first step would be to backup your site to revert the changes in case any compatibility or other issues arise with the latest PHP version. In WordPress, this can be done by using several plugins. However, in this article, we shall use the WordPress plugin called UpdraftPlus which has more than 2 million active installations. To use this plugin:

  1. Firstly install and activate the UpdraftPlus plugin.
  2. Navigate to Dashboard>Settings>UpdraftPlus Backups.
  3. Here, click on the “Backup Now” button as shown in the image.
  4. Now it will present you with a tab to include both database and files. Include both the checkboxes as shown in the image below. The backup will take some time depending on your files and when it is complete, it can be checked under the “Existing Backups” option.
  5. Navigate to Dashboard>Settings>UpdraftPlus Backups>Existing Backups. Here you will find your backup along with the time stamp. Click on the Database, Plugins, Themes, and Uploads buttons one by one to download them in a folder on your local computer. Once completed, this folder will contain the entire backup of your WordPress site.

Checking For Compatibility Issues

It is a wise thing to check your WordPress site for any compatibility issues before making the final upgrade to PHP 8. For such a scenario, the Staging site comes in handy as it allows you to make a clone of your live website. Many solutions can help you in the staging of your site, but for this article, we shall use Local by Flywheel. This solution will help you test your website in a local environment. To do so:

  1. Download and install the Local by Flywheel on your computer like any regular software.
  2. Open the application and click on the plus sign in the lower left-hand corner to add a new local website. Thereafter, it will ask you for the options Name and Environment. In the Environment option, Click on Custom as shown in the image.
  3. Now in the Custom options, you will have the choice to select PHP 8 as the preferred choice. Thereafter create the admin name and password and wait while the app creates the staging area. Once it is ready, it can be found under the list of Local Sites option of the Flywheel’s app. Click on the Admin button to access the Dashboard.
  4. Now, install the UpdraftPlus plugin on this local site to upload your backup here. When it’s done, navigate to Dashboard>Settings>UpdraftPlus Backups. Here click on the option Upload backup files.
  5. Finally, drag and drop your four backup files to the area shown in the image. When it is complete, click on the Restore button to finish cloning your site.

Finding Compatibility Issues

Now browse through your site to see any compatibility issues. Some of the things to look out for are:

  • Look at every page of your WordPress site to see if any of the element is not functioning properly.
  • Check the functionality of plugins.
  • Test the functionality of themes.

All this will take time depending on how big your website is. If you encounter any plugin or theme etc broken during your inspection, look for a replacement as WordPress offers many alternatives.

Updating the PHP Version

The PHP version is primarily updated on the server level and not from WordPress directly. Therefore, it leads us to two scenarios: Either you use a VPS or other hosting option which allows you complete control over the server or your hosting option doesn’t give you complete access over the server.

  1. Case 1: Here is a complete list of hosting providers that allows you to update PHP by yourself. This list also contains the complete process to do so. Moreover, if you have access to the command line, you can also update it yourself using this article.
  2. Case 2: If your hosting provider is not given in the above-mentioned list and you do not have complete access over the server, request your hosting provider to update your PHP version. This can be done by writing an email to your Hosting provider requesting them to update the PHP version.

Make sure to check for any compatibility issues before updating. However, in case you still encounter any problems after updating, roll back the changes to previous PHP versions or contact your Hosting provides or seek the help of a professional developer. In the worst-case scenario, if your host does not allow updating to the latest PHP version, it is time that you found a new host.

Conclusion

Update to PHP 8.x today to avoid any security complications. This will also mean enhanced performance for your website. Besides the PHP version, there are several 0ther WordPress security measures that you need to take care of. We have compiled this extensive WordPress security guide which can help you immensely in ensuring the best security practices for your WordPress.

Still got any questions? Comment below.

Vikas Kundu

Vikas is a computer science graduate with a keen interest in cybersecurity. Besides programming cool software, he also shares his knowledge on website security on niche blogs. He has written over 150 technical write-ups to date and is still actively writing. In his free time, he can be found playing football.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

4 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Manam Khan
Manam Khan
4 years ago

Thank you so much for the information. Do you guys have any guide on WordPress Security & Malware scanning? I am seeing few hack symptoms like file manipulation, what do you recommend in case of WordPress?

Naman Rastogi
4 years ago
Reply to  Manam Khan

Thanks, Manam.
You can find our comprehensive WordPress Security guide here – https://www.getastra.com/blog/cms/wordpress-security/wordpress-security-guide/

If you are seeing hack symptoms, we recommend you to compare your core files first. You can follow our step-by-step guide on Fixing hacked WordPress site – https://www.getastra.com/blog/911/wordpress-site-hacked-malware-backdoor/

You can also use our malware scanner to detect the scripts & remove them. You can choose a plan from here – https://www.getastra.com/pricing

Ingo
Ingo
2 years ago

Just a hint – We’re in php8.x times now. Currently got a security-warning that I should update to the latest 7.4 – even when running the latest 8.0-version 😉

Kanishk Tagade
2 years ago
Reply to  Ingo

Hello, thanks for the heads up. We have just updated the article with latest information. Good day 🙂

Psst! Hi there. We’re Astra.

We make security simple and hassle-free for thousands
of websites and businesses worldwide.

Our suite of security products include a vulnerability scanner, firewall, malware scanner and pentests to protect your site from the evil forces on the internet, even when you sleep.

earth spiders cards bugs spiders

Made with ❤️ in USA France India Germany