Fatal error: Maximum execution time of 300 seconds

2020-01-26 01:51发布

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

18条回答
别忘想泡老子
2楼-- · 2020-01-26 02:24

PHP's CLI's default execution time is infinite.

This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser. This helps prevent poorly written scripts from tying up the server. The default setting is 30. When running PHP from the command line the default setting is 0.

http://gr.php.net/manual/en/info.configuration.php#ini.max-execution-time

Check if you're running PHP in safe mode, because it ignores all time exec settings when on that.

查看更多
闹够了就滚
3楼-- · 2020-01-26 02:27

go to the xampp/phpmyadmin/libraries/config.default.php

and make the following changes

from  $cfg['ExecTimeLimit'] = ’300′;
to  $cfg['ExecTimeLimit'] = ’0′;
查看更多
在下西门庆
4楼-- · 2020-01-26 02:28

For Xampp Users

1. Go to C:\xampp\phpMyAdmin\libraries
2. Open config.default.php
3. Search for $cfg['ExecTimeLimit'] = 300;
4. Change to the Value 300 to 0 or set a larger value
5. Save the file and restart the server
6. OR Set the ini_set('MAX_EXECUTION_TIME', '-1'); at the beginning of your script you can add.
查看更多
可以哭但决不认输i
5楼-- · 2020-01-26 02:29

You can set time limit:

ini_set('max_execution_time', 1000000000000000);
查看更多
在下西门庆
6楼-- · 2020-01-26 02:30

Try something like the following in your script:

set_time_limit(1200);
查看更多
时光不老,我们不散
7楼-- · 2020-01-26 02:31

Xampp Users

  1. Go to xampp\phpMyAdmin\
  2. Open config.inc.php
  3. Search for $cfg['ExecTimeLimit'] = 300;
  4. Change to 0 for unlimited or set a larger value
  5. If not found add $cfg['ExecTimeLimit'] = 0; (or a larger value)
  6. Save the file and restart the server
查看更多
登录 后发表回答