Page 1 of 1
Keeping script alive when set_time_limit() not there?
Posted: Sat Oct 11, 2008 2:46 am
by kkonline
Hi,
Is there anyway i can keep a script running till it completes if set_time_limit(0); is not allowed?
Re: Keeping script alive when set_time_limit() not there?
Posted: Sat Oct 11, 2008 3:46 am
by mattcooper
Do you have access to the php.ini config file? If so, look for this block and alter accordingly:
Code: Select all
;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;
max_execution_time = 30 ; Maximum execution time of each script, in seconds
max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
memory_limit = 128M ; Maximum amount of memory a script may consume (128MB)
If not, use the ini_set() function in your applicationconfig/bootstrap file:
Code: Select all
<?php
$intTimeInSeconds = 300; // or however long you want to keep your script running
ini_set('max_execution_time', $intTimeInSeconds);
?>
There are other methods, but one of the above should work for you - and do make sure PHP isn't running in safe mode
