If you are looking for a significant increase in your site’s performance then you should look into switching to using PHP 7 with Opcache.
Performance increases of over 100% have been reported, with WordPress sites running more than twice as fast with PHP 7 compared to PHP 5.6.
How does PHP 7 improve your site’s performance?
The enormous increases in speed of PHP 7 are the result of improvements to the Zend Engine, the use of opcode caching and improvements in the data structure. This results in an improved data structure, a reduction in memory requirements and memory management that is more efficient.
How does OpCache work?
PHP scripts are usually compiled at runtime, which means that part of the computing time is required to convert the code and have it ready. With Op Cache this conversion is calculated once, then pre-compiled and saved as a machine readable script in the cache.
When this script is needed it can be loaded extremely quickly from the cache, which in most cases improves the speed of the site significantly.
OpCache is of particular benefit to large websites, such as eCommerce and company sites, which are able to handle far more requests simultaneously when OpCache is enabled.
Comparability considerations of PHP 7
While PHP 7 is generally compatible with older versions of PHP, some conflicts can occur. Joomla 3.4 has issues with PHP 7 for example, but as of Joomla 3.5 these problems have been fixed.
We recommend testing PHP 7 with your site’s plugins and scripts in a development or test environment first, and if there are no issues roll the updates out to your live site.
Activating PHP 7
You can activate PHP 7 on Plesk or cPanel, depending on the control panel that you are using. In both instances, you need to login and open the PHP Selector.
Once you have set your PHP Selector to PHP 7 you can activate OpCache for your website.
Activating OpCache requires that you setup a folder for the cached files in your webspace and add a few lines of code to your php.ini file in the root of your site.
Create a folder for cached files
Login to your webspace using ftp, then in the root directory create a folder for the cached files. Name the folder something like “.opcache” (without the speachmarks), the point at the beginning of the name will make Apache automatically protect the folder.
Add some lines to the php.ini file
Open the php.ini file, found in the root folder of your website, and add the following code:
Note that the value for opcache.file_cache (highlighted above) must be the absolute path to your webspace.
Save your changes to the php.ini file and upload it to your webspace, overwriting the original.
Verify everything is working
After OpCache has been enabled and your website has been accessed a couple of times you will notice that the .opcache folder will have some cached files inside it. If there are no files inside, it’s likely that value for opcache.file_cache in the php.ini file is incorrect, check the path and try again.