From 796b2b711f22775ef8e2a578bd71d065f9800442 Mon Sep 17 00:00:00 2001 From: Jack Webb-Heller Date: Thu, 1 Dec 2011 11:56:12 +0000 Subject: CodeIgniter ignores the set config value for Maximum Execution Time, overwriting it with its own value of 300 seconds. Whilst this is sensible in the vast majority of situations (browsers), when running a script from CLI, it is likely that execution times may need to be longer. Therefore, don't override the time limit if being run from the CLI - instead default back to PHP's own configuration. --- system/core/CodeIgniter.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'system') diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index 4d76a5587..abdbf91d8 100755 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -106,9 +106,13 @@ * Set a liberal script execution time limit * ------------------------------------------------------ */ - if (function_exists("set_time_limit") == TRUE AND @ini_get("safe_mode") == 0) + if (function_exists("set_time_limit") AND @ini_get("safe_mode") == 0) { - @set_time_limit(300); + // Do not override the Time Limit value if running from Command Line + if(php_sapi_name() != 'cli' && ! empty($_SERVER['REMOTE_ADDR'])) + { + @set_time_limit(300); + } } /* -- cgit v1.2.3-24-g4f1b