You will also learn how to switch WordPress from PHP 5 to 7 on Shared Hosting, VPS/Cloud. PHP7 was released in 2015 with many performance improvements but it looks like the industry is yet to adopt the new version of PHP. As you can see PHP7 got just above 3% of market share despite providing better features. Does it lack awareness? I read a lot of articles on PHP7 vs. PHP5, so thought to give it a try and see how fast PHP7 is on the WordPress website. Before jumping to the results, some worth mentioning features of PHP7 are:

Reduced memory usageConsistent 64-bit supportThe new version of Zend engineNew engine exception for better error handlingAdds anonymous classesFaster loading website (of course)

The latest version of WordPress officially supports PHP7. Let’s find out how they perform with PHP7.

Testing Details

A little bit of platform and testing procedure to give you a clear picture.

I provisioned Linode $10 plan and did the following.Installed WordPress 4.7 on Ubuntu 16.04 LTS through EasyEngineInstalled Blogging Theme by MyThemeShopDidn’t use any caching plugin or CDNUsed Loader to perform a load test with 50-200 clients for one minute.

WordPress performance on PHP-FPM 5.6

By default, EasyEngine installs PHP-FPM 5.6, so I didn’t have to do any configuration except setting up WordPress, installing the theme & pointing my test domain to Linode VM IP. I went to Loader to perform the test and here is the result:

Average response time: 11.96sMinimum response time: 0.6sMaximum response time: 19s

WordPress performance on PHP-FPM 7.0

I switched to PHP 7 through Easy engine and results are: Amazing! You see PHP7 is two times faster. PHP7 performed well in all aspects.

The average time is 5.1 seconds compare to 11.96s with PHP 5.6Minimum response time is 0.4 seconds compare to 0.6sMaximum response time is 8.2 seconds compare to 19s

Just by switching WordPress from PHP 5.6 to PHP 7 decreased the website load time by 50%. I believe it’s the quick win for any WordPress website and if you are still not using the latest PHP version, then this test result should encourage you to upgrade.

Compatibility Checker

You may want to check your theme and plugin to ensure they are compatible with PHP 7 so it doesn’t break post update. PHP Compatibility Checker plugin by WPEngine will help you to analyze your existing theme and plugin and let you know they are ok with PHP 7.

How to Switch from PHP 5 to 7?

There are multiple ways to achieve this based on the platform you use.

If using EasyEngine

Probably one of the quickest ways to switch stack version is using EasyEngine. Login to your VPS/Cloud where EasyEngine is installed Execute eecommand Ex: You can use ps command to verify PHP 7 is running. Note: if you notice PHP 5 and seven both are running then you can stop the PHP 5 and remove from the auto start-up.

If using Shared Hosting

If you are on shared hosting that provides cPanel, you can change the PHP version by yourself as the following. However, if you don’t have cPanel, then you may need to speak to your hosting provider. The following screenshot is taken from SiteGround.

Login to your cPanelClick “PHP Version Manager” under 1H Software

Select the site to change the PHP versionChange the version and click Save

You will get a confirmation that new version is applied to your site home. Well done! You just made your WordPress site faster on shared hosting.

If hosting on Kinsta

Kinsta is a premium managed WP hosting that leverages Google Cloud to deliver best possible experience ever! You can switch the PHP version from MyKinsta.

If hosting on Cloud/VPS

If you are hosting your WordPress on Cloud or VPS like Google Cloud, AWS, Linode, DO, etc. and have installed everything manually on your own then you can do the following (example for CentOS 6.x )to upgrade PHP.

Login to your CentOS VMTake a backup of VM before the upgrade so you can rollback in-case thing goes wrongRemove existing PHP version

Install the following repository

Install PHP-FPM 7 and its required module

Restart Nginx, MySQL & PHP-FPM to ensure it’s loaded with the latest version. You may also access the WordPress website to ensure its functionality. Congratulation! You have successfully installed PHP-FPM 7. You may do the following if you want to verify the version.

Conclusion

I hope the above gives you an idea of how to implement PHP-FPM 7 for WordPress and its performance advantages. So go ahead and give a try to PHP-FPM 7 to experience the fast loading WordPress website.

How Fast is WordPress with PHP FPM 7 Compare to 5  - 13How Fast is WordPress with PHP FPM 7 Compare to 5  - 95How Fast is WordPress with PHP FPM 7 Compare to 5  - 39How Fast is WordPress with PHP FPM 7 Compare to 5  - 46How Fast is WordPress with PHP FPM 7 Compare to 5  - 91How Fast is WordPress with PHP FPM 7 Compare to 5  - 24How Fast is WordPress with PHP FPM 7 Compare to 5  - 77How Fast is WordPress with PHP FPM 7 Compare to 5  - 72How Fast is WordPress with PHP FPM 7 Compare to 5  - 59How Fast is WordPress with PHP FPM 7 Compare to 5  - 5How Fast is WordPress with PHP FPM 7 Compare to 5  - 62How Fast is WordPress with PHP FPM 7 Compare to 5  - 53How Fast is WordPress with PHP FPM 7 Compare to 5  - 29How Fast is WordPress with PHP FPM 7 Compare to 5  - 4How Fast is WordPress with PHP FPM 7 Compare to 5  - 11How Fast is WordPress with PHP FPM 7 Compare to 5  - 98How Fast is WordPress with PHP FPM 7 Compare to 5  - 81How Fast is WordPress with PHP FPM 7 Compare to 5  - 18How Fast is WordPress with PHP FPM 7 Compare to 5  - 43How Fast is WordPress with PHP FPM 7 Compare to 5  - 59How Fast is WordPress with PHP FPM 7 Compare to 5  - 37How Fast is WordPress with PHP FPM 7 Compare to 5  - 40How Fast is WordPress with PHP FPM 7 Compare to 5  - 22How Fast is WordPress with PHP FPM 7 Compare to 5  - 77How Fast is WordPress with PHP FPM 7 Compare to 5  - 98How Fast is WordPress with PHP FPM 7 Compare to 5  - 46How Fast is WordPress with PHP FPM 7 Compare to 5  - 73How Fast is WordPress with PHP FPM 7 Compare to 5  - 84How Fast is WordPress with PHP FPM 7 Compare to 5  - 30How Fast is WordPress with PHP FPM 7 Compare to 5  - 91How Fast is WordPress with PHP FPM 7 Compare to 5  - 73How Fast is WordPress with PHP FPM 7 Compare to 5  - 3