Viewed   203 times

I keep getting this PHP error:

Fatal error: Maximum execution time of 300 seconds exceeded

I have tried setting my max_execution_time and my max_input_time settings in php.ini (both apache and cli) to 0, -1 and 4000 seconds each.

And i still get the error saying:

Fatal error: Maximum execution time of 300 seconds exceeded

As well my script runs over 300 seconds before i get this message

I am running the script through command line.

I also checked my phpinfo() so see which php.ini I am using.

Even more interesting I have tried setting max_execution_time and max_input_time settings to 5 second and my script will run way beyond 5 seconds before I get the:

Fatal error: Maximum execution time of 300 seconds exceeded



At the beginning of your script you can add.

ini_set('MAX_EXECUTION_TIME', '-1');
Friday, September 2, 2022

Problem solved, php build with litespeed api (lsapi) has extra env variable to determine max execute time - LSAPI_MAX_PROCESS_TIME (default is 300sec).

Monday, October 17, 2022

Per the inline documentation

The return value is an array of two elements: the list of parsed options and the list of non-option command-line arguments. Each entry in the list of parsed options is a pair of elements - the first one specifies the option, and the second one specifies the option argument, if there was one.

Which means you easily discard the second array, and assume a commitment to the keeping the array of arrays, first element option, second element value, format.

With that assumption in place, try

$o= new Console_Getopt;
$opts = $o->getopt($argv, "a:b:c");

function getHashOfOpts($opts) {
    $opts = $opts[0];
    $return_opts = $opts;
    $return_opts = Array();
    foreach($opts as $pair){
        $return_opts[$pair[0]] = $pair[1];
    return $return_opts;

to get an data structure more of your liking.

As for why this is different than other implementation of getopt, ask the maintainers.

Thursday, August 11, 2022

set it too 300 which is approx 300 secs = 5 minutes

ini_set('MAX_EXECUTION_TIME', 300);

if you set it to 0 , which mean no limits.

ini_set('MAX_EXECUTION_TIME', 0);

for cURL you can use this one

curl_setopt($ch, CURLOPT_TIMEOUT, 0);

here again 0 means infinite...

Wednesday, October 5, 2022

it's a bug in mysql. you can solve it by getting the latest libmysql.dll (5.1.31 or higher. some older versions also work - see second link). make sure that's the libmysql.dll actually used and there are no other libmysql.dlls in your path. see the related php issue for details.

Tuesday, August 30, 2022
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :