I've got a dedicated box (so I can edit all settings) running PHP 5.2.16.
I have both Max_execution_time and max_input_time set to under 60, restarted apache (using apachectl -k graceful) but scripts never time out.
I've tested this with two scripts (actually, I first noticed it with 'real' scripts that probably should have timed out but never did)
while (1) { sleep(10); }
and because apparently sleep() doesnt affect max_execution_time() i tried this:
while(1) { file_get_contents($url); }
($url = a large image. i also echoed stuff so i knew it was running)
I can run scripts for over 10 mins.
Things I've checked:
Doing this:
echo ini_get('max_execution_time');
echos out 60 (which is from php.ini)
Doing this:
set_time_limit(5); echo ini_get('max_execution_time');
echos out 5
but in both cases the script will run and run forever!
- I've restarted apache
- I've checked the
max_execution_time
andmax_input_time
in/etc/php.ini
. as far as i can tell there is no otherphp.ini
. - There is nothing in a .htaccess in any 'previous' (higher) directory saying anything about
max_execution_time
orset_time_limit
And as mentioned this isn't just a problem when I use sleep()
– I've noticed that I can upload and process hundreds of files without needing a set_time_limit(0)
there.
Best Answer
You are probably falling on stream operations when using file_get_contents.
Try with: