Set unlimited execution time and memory limit in CLI script
Added `set_time_limit(0)` to prevent timeout for long-running scripts and set `memory_limit` to unlimited to handle extensive memory usage. These changes ensure the script can handle resource-intensive operations without interruptions.
This commit is contained in:
@@ -22,6 +22,13 @@ if (php_sapi_name() === 'cli') {
|
||||
}
|
||||
}
|
||||
|
||||
// Set the max execution time to 0
|
||||
// This is used to prevent the script from timing out
|
||||
// when running for a long time
|
||||
set_time_limit(0);
|
||||
// Set the memory limit to unlimited
|
||||
ini_set('memory_limit', '-1');
|
||||
|
||||
|
||||
// If the first argument is 'run', switch to the second argument
|
||||
if ($args[1] === 'run') {
|
||||
|
||||
Reference in New Issue
Block a user