Updated on May 9, 2018
In this final tutorial, we would like to provide our customers with useful advice on the best practices for maintaining healthy Web Hosting account with us. Particularly we would like to outline the most used approaches for decreasing the amount of Script Executions while even increasing the amount of traffic a website can get.
Cloudflare is a well-known Content Delivery network which we have reviewed in our Cloudflare Tutorial Series used by millions of websites over the web these days. The service not only provides static content caching and optimization but also it will protect customer's website from various web attacks such as DDoS and also it provides Web Application Firewall which will protect a website against known application attacks such as SQL injection attacks or Cross Site Scripting attacks.
In the context of the Script Executions, however, Cloudflare helps by reducing the amount of request a visitor will make to the web server. As we mentioned, each web page represents a batch of requests for static and dynamic resources. However, in many cases on the server side, the static resources are generated by dynamic PHP scripts. In these cases, there will be a single Script Execution for example for the generation of static CSS file or js file. Now imagine that a single web page contains of 10 static resources and all these are generated dynamically. Well, a single visit will then cause 10 Script Executions. However, if Cloudflare is being used these requests will not reach the web server at all since Cloudflare will deliver these files from its cache.
Available on our FastCloud Extra plans, the opcode cache is a feature that allows for the result of PHP Script Execution to be cached and further provided as a response to a request made for that script. This reduces the amount of Script Executions dramatically and should be considered wherever possible. Please note that websites with varying dynamic content (changing often) cannot benefit from the caching method in question.
This feature can be activated via the Select PHP Version feature of the cPanel service and then by simply activating the PHP module "Opcache".
Please note that the service requires no further configuration and it will start caching immediately.
APC stands for Alternative PHP Cache, and it is mainly used for caching the response of PHP Script Execution. It is a PHP Extension specifically enabled on our FastCloud Extra plans and can be activated via the Select PHP Version feature of the cPanel service and then by simply activating the PHP module "apcu".
Once APC is activated as PHP extension, however, our customers will need to configure their application for the usage of this cache. Depending on the application this can be done differently, but in most of the cases, a plugin/module will have to be installed. For example, a perfect Caching plugin for Wordpress that will take advantage of all the caching technologies we describe is W3 Total Cache.
This is another great cache engine that provides caching for different types of strings objects, results of database calls, API calls or page rendering. It will dramatically improve the amount of Script Executions once activated.
In order to activate it, however, you will have to contact our technical support team since this cache engine consist of PHP Extension and also a daemon which only our technical team can start for a customer.
Again it perfectly integrates with W3 Total Cache Wordpress plugin after short configuration session.
Ensuring that all the error pages that can be returned to a request on your website will be static is the thing that will save probably the largest amount of Script Executions. We already explained that approach and the reasons why this is so important in our "Reasons for High PHP Executions" tutorial
The cron jobs are something that often causes too many Script Executions. These can be dramatically reduced by only changing the timing of the cron jobs and also by changing all the wget based crons to php based. We have provided detailed explanation on that subject here.