Simply Fast WordPress [6] 1000x Faster WordPress Tuning – PHP 7

This is a series of articles explaining how to speed up WordPress, the use of which is growing rapidly for CMS-based business sites and media sites. In the next few articles, I will offer techniques to tune WordPress’ speed by 1000x. --Kengyu Nakamura, Prime Strategy Co., Ltd.

In the previous article, we created a PHP5.6+OPCache+APCu environment by installing EPEL and Remi repositories, and sped up WordPress 5.5x the default environment.

In this article we will switch to PHP 7 and improve performance even more.

WordPress Japanese version
WordPress Japanese version

This technique continues from previous tuning, so please refer to earlier articles to get to this point.

Install PHP 7+OPCache+APCu

We will be changing the PHP execution environment to PHP 7. PHP 7 is the first major release in 10 years, and it has been greatly improved to have better features and use less memory.

PHP 7 download site
PHP 7 download site

PHP 7 can achieve at least 200% better performance than PHP 5. Also, it has forwards-compatibility and can be used with WordPress version 4.4 or later. However, it may not be available with certain themes and plugins, so keep that in mind.

Anyway, let's install PHP 7 from the Remi repository. Since it doesn't rely on PHP 5.6, we will be removing those files before installing using yum.

[root@ip ~]# yum remove php* -y
[root@ip ~]# yum --enablerepo=remi,remi-php70 install php php-mysqlnd php-gd php-xml php-xmlrpc php-mbstring php-mcrypt php-fpm php-opcache php-apcu -y

With this, installation is complete. To make sure there are no errors, use php -v to confirm the status.

[root@ip ~]# php -v
PHP 7.0.5 (cli) (built: Mar 30 2016 09:59:14) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
[root@ip ~]# php -i | egrep 'apc|opcache'
Additional .ini files parsed => /etc/php.d/10-opcache.ini,
/etc/php.d/40-apcu.ini,
/etc/php.d/50-apc.iniapcapcu
MMAP File Mask => /tmp/apc.XXXXXX
apc.coredump_unmap => Off => Off
apc.enable_cli => Off => Off
apc.enabled => On => On
(omitted)
opcache.blacklist_filename => /etc/php.d/opcache*.blacklist => /etc/php.d/opcache*.blacklist
opcache.consistency_checks => 0 => 0
opcache.dups_fix => Off => Off
opcache.enable => On => On
opcache.enable_cli => Off => Off
(omitted)