Skip to content Skip to sidebar Skip to footer

Confusing PHP/AJAX Timeout After 900 Secs(15 Mins)

all of the below is based on Linux, recent Apache, recent PHP module for Apache. I am experiencing an unexpected behavior for my AJAX+PHP based web-application. It is quite a simpl

Solution 1:

In your php.ini there is a max_execution_time, the default is 30 seconds, so it seems somewhere it has been set to 900. So I would check there first. Info: http://www.php.net/manual/en/info.configuration.php#ini.max-execution-time

As for solving it, you can edit the php.ini to set that value really high (or 0 for unlimited), or alternatively you might be able to use this function: http://php.net/manual/en/function.set-time-limit.php to reset it after say 300 seconds.

Hope this helps!

Edit: added Lee's suggestion of 0 value max_execution_time

Edit 2:

Just found something interesting here http://www.php.net/manual/en/function.set-time-limit.php#75557

Please note that, under Linux, sleeping time is ignored, but under Windows, it counts as execution time.

So, that could be why its allowed to execute for longer than 30 seconds, but still cutting it off eventually.


Solution 2:

I tried your example and place it in a different host (not localhost). In my case it ran fine and got the "none" value after 900 seconds. I removed the SESSION calls to simplify the example...

Try it without session. If that changes something, then maybe "session.cookie_lifetime" value could be related.


Solution 3:

Search for the value 900 in all your php.ini and .htaccess:

grep -HR 900 $(locate php.ini ) $(locate -e .htaccess )

also search for 900 and fractions of 900 in your source code:

cd /var/www/ #path_to_yoursite
grep --color=auto -HR "=\s*900\b"
grep --color=auto -HR "=\s*20\s*\*\s*45\b"
grep --color=auto -HR "=\s*15\s*\*\s*60\b"
...

Post a Comment for "Confusing PHP/AJAX Timeout After 900 Secs(15 Mins)"