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:
Jepp9350
2025-04-09 15:18:34 +02:00
parent ce2e233e5f
commit 20442ea441
+7
View File
@@ -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') {