Very common situation when you have some long-running Php script that exceeds Php’s max_execution_time directive. The easiest way to overcome this limit is to increase it’s value:

In your .php script file:


Or in php.ini file:

max_execution_time=300;300 seconds

Note that in later example this limit will be used for EVERY script.

But the problem is that not always you have access to php.ini file (E.g. when using shared hosting) or overwriting of max_execution_time is not allowed for scripts.

In this case, possible solution is to divide script execution into parts limited by time execution (Like you can limit query results in MySql with help of LIMIT 20, 30 or similar).

I wrote a small class which makes code division a very simple thing.
Continue reading

Share Button