Hi,
Is there anyway i can keep a script running till it completes if set_time_limit(0); is not allowed?
Keeping script alive when set_time_limit() not there?
Moderator: General Moderators
- mattcooper
- Forum Contributor
- Posts: 210
- Joined: Thu Mar 17, 2005 5:51 am
- Location: London, UK
Re: Keeping script alive when set_time_limit() not there?
Do you have access to the php.ini config file? If so, look for this block and alter accordingly:
If not, use the ini_set() function in your applicationconfig/bootstrap file:
There are other methods, but one of the above should work for you - and do make sure PHP isn't running in safe mode 
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)
Code: Select all
<?php
$intTimeInSeconds = 300; // or however long you want to keep your script running
ini_set('max_execution_time', $intTimeInSeconds);
?>