I get messages saying "Maximum execution time exceeded"

As a way to confine programming errors in PHP scripts that block a server from continuing to operate properly, many server hosts set a maximum execution time for any given PHP page. This limit is generally set at 30 seconds: if a page attempts to run a calculation that takes more than 30 seconds (an enormous calculation or an infinite loop), then the server will interrupt the calculating process and issue an error message. For SPIP, this normal limit of 30 seconds is largely enough for almost all of its calculations and processes.

However, some server hosts set these maximum execution periods to be very brief. This is notably the case with Free (15 seconds) and Online (8 seconds). In addition, these server hosts generally only allocate a small amount of memory to SPIP processes, which can significantly slow down process execution. Because of this, the SPIP processes running on these host machines take longer to run and the maximum process time is ridiculously short. Pretty much like a train that runs for only one hour, and which needs to cover a distance of 120 kilometres on lines which have maximum speed ratings of only 60 km/h: the train would always stop halfway to its destination in the middle of nowhere.

This problem occurs quite systematically with long articles: with such server hosts, the calculation of the pages are interrupted by the server before they are completed, which means the pages can not be displayed and which will provoke an error message reading "Maximum execution time exceeded".

In such circumstances, there isn’t really any technical solution for you to call on. SPIP has already been largely optimised to run as fast as possible, and the problem then lies with the server host.

-  The only instant solution: host your site somewhere else, with an ISP that supplies a functional service and not one that has been unreasonably constrained. You might sometimes have access to the PHP configuration file for your site (the /etc/php/apache/php.ini file on typical Linux servers), which offers you the chance to increase the max_execution_time parameter.

-  Alternatively, try writing to the manager of your hosting service to request that the maximum execution time of PHP scripts be extended (to 30 seconds like most of the computer world, perhaps). You never know, you just might get a positive response that’s adequate... But as far as our experience shows, the absence of positive reactions tends to indicate a deliberate policy to slow down free hosting services as a way to "encourage" webmasters to switch to a chargeable hosting package, rather than any genuine technical restriction. You can still get something for free, it just may well not be what you actually need though.

Author Mark Published : Updated : 26/10/12

Translations : corsu, English, Español, français, italiano, Nederlands, Türkçe