English English French French Spanish Spanish German German
Geekflare is supported by our audience. We may earn affiliate commissions from buying links on this site.
Share on:

How Fast is WordPress with PHP-FPM 7 Compare to 5?

php
Invicti Web Application Security Scanner – the only solution that delivers automatic verification of vulnerabilities with Proof-Based Scanning™.

PHP7 has many performance advantages, and in this post, I’ve performed a test to find out the WordPress performance in PHP 5.6 and 7.

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.

php-market-share

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 usage
  • Consistent 64-bit support
  • The new version of Zend engine
  • New engine exception for better error handling
  • Adds anonymous classes
  • Faster 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 EasyEngine
  • Installed Blogging Theme by MyThemeShop
  • Didn’t use any caching plugin or CDN
  • Used 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:

php-fpm5-test-result
  • Average response time: 11.96s
  • Minimum response time: 0.6s
  • Maximum response time: 19s

WordPress performance on PHP-FPM 7.0

I switched to PHP 7 through Easy engine and results are:

php-fpm7-test-result

Amazing! You see PHP7 is two times faster. PHP7 performed well in all aspects.

Wordpress-performance
  • The average time is 5.1 seconds compare to 11.96s with PHP 5.6
  • Minimum response time is 0.4 seconds compare to 0.6s
  • Maximum 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.

php7-compatibility-wordpress

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 <strong>ee</strong>command

ee site update yourwebsite.com --php7

Ex:

root@ubuntu:~# ee site update chandan.io --php7
PHP7.0 is experimental feature and it may not work with all plugins of your site.
You can disable it by passing --php7=off later.
Do you wish to enable PHP now for chandan.io?
Type "y" to continue [n]:y
Running pre-update checks, please wait...
Backup location : /var/www/chandan.io/backup/25Feb2017093100
Backing up database          [Done]
Setting up NGINX configuration      [Done]
Setting up webroot           [Done]
Reload : nginx     [OK]
Successfully updated site http://chandan.io
root@ubuntu:~#

You can use ps command to verify PHP 7 is running.

root@ubuntu:~# ps -ef|grep php
root     17274     1  0 Feb24 ?        00:00:04 php-fpm: master process (/etc/php/7.0/fpm/php-fpm.conf)
root     26674 26541  0 09:31 pts/0    00:00:00 grep --color=auto php
root@ubuntu:~#

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 cPanel
  • Click “PHP Version Manager” under 1H Software
siteground-php7
  • Select the site to change the PHP version
  • Change the version and click Save
siteground-php-version-selection

You will get a confirmation that new version is applied to your site home.

siteground-php-changed

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.

kinsta-php-switch

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 VM
  • Take a backup of VM before the upgrade so you can rollback in-case thing goes wrong
  • Remove existing PHP version
yum remove php-fpm php-cli php-common
  • Install the following repository
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
  • Install PHP-FPM 7 and its required module
yum install php70w-fpm-nginx php70w-cli php70w-mysqlnd php70w-fpm

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.

[root@li1177-13 init.d]# /usr/sbin/php-fpm -version
PHP 7.0.16 (fpm-fcgi) (built: Feb 18 2017 10:46:38)
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
[root@li1177-13 init.d]#

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.

Thanks to our Sponsors
More great readings on WordPress
Power Your Business
Some of the tools and services to help your business grow.
  • Invicti uses the Proof-Based Scanning™ to automatically verify the identified vulnerabilities and generate actionable results within just hours.
    Try Invicti
  • Web scraping, residential proxy, proxy manager, web unlocker, search engine crawler, and all you need to collect web data.
    Try Brightdata
  • Semrush is an all-in-one digital marketing solution with more than 50 tools in SEO, social media, and content marketing.
    Try Semrush
  • Intruder is an online vulnerability scanner that finds cyber security weaknesses in your infrastructure, to avoid costly data breaches.
    Try Intruder