Fatal error: maximum run time exceeded 300 seconds

I keep getting this PHP error:

Fatal error: maximum run time exceeded by 300 seconds

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

And I still get the error message:

Fatal error: maximum run time exceeded by 300 seconds

In addition, my script runs for more than 300 seconds before I receive this message.

I run the script through the command line.

I also checked my phpinfo() , so I'll see which php.ini I use.

Even more interestingly, I tried setting the max_execution_time and max_input_time settings to 5 seconds, and my script would run 5 seconds before I get:

Fatal error: maximum run time exceeded by 300 seconds

+73
command-line-interface php
Oct 06 2018-11-21T00:
source share
17 answers

At the beginning of your script you can add.

 ini_set('MAX_EXECUTION_TIME', '-1'); 
+56
Oct. 06 2018-11-21T00:
source share

If you are using WAMP, go to:

Increase max_execution_time in php.ini , then go to

C:\wamp\apps\phpmyadmin3.4.10.1\libraries (change the path according to your installation)

open config.default.php and change the value for $cfg['ExecTimeLimit'] to 0:

 $cfg['ExecTimeLimit'] = 0; 

This will solve the PhpMyAdmin import problem.

+82
Jul 04 '13 at 9:33
source share

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 higher value
  5. If not found, add $cfg['ExecTimeLimit'] = 0; (or greater value)
  6. Save the file and restart the server
+50
Jan 10 '14 at 18:21
source share

I faced a similar situation, and it turns out that Codeigniter (the PHP framework I use) actually sets its own time limit:

In system / core / Codeigniter.php line 106 in version 2.1.3 appears:

 if (function_exists("set_time_limit") == TRUE AND @ini_get("safe_mode") == 0) { @set_time_limit(300); } 

Since there was no other way to avoid modifying the main file, I deleted it to allow configuration via php.ini, as well as to give an infinite maximum execution time for the CLI request.

I recommend recording this change somewhere for future updates to the CI version.

+23
Apr 17 '13 at 3:50
source share

Try the following steps in the script:

 set_time_limit(1200); 
+9
Oct 06 2018-11-21T00:
source share

This is the correct answer:

switch to

 c:\wamp\apps\phpmyadmin3.4.10.1\libraries\config.default.php 

find and install

 $cfg['ExecTimeLimit'] = 0; 

restart all services and done.

+6
Oct 09 '13 at 15:40
source share

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

and make the following changes

 from $cfg['ExecTimeLimit'] = '300′; to $cfg['ExecTimeLimit'] = '0′; 
+4
Feb 08 '17 at 18:35
source share

The default runtime for the PHP CLI is infinite.

This sets the maximum time in seconds that a script can run before it is completed by the parser. This helps prevent bad written scripts from binding the server. The default value is 30. When you start PHP from the command line, the default value is 0.

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

Check if PHP is running in safe mode, because it ignores all temporary exec settings when on it.

+1
06 Oct 2018-11-21T00:
source share

WAMP USERS:

1) Go to the folder C: \ wamp \ apps \ phpmyadmin

2) Open config.inc

3) Add $ cfg ['ExecTimeLimit'] = 3600 '; to the file.

4) Save the file and restart the server.

This file overwrites php.ini and will work for you!

0
Dec 09 '13 at 15:43
source share

In my case, when I encountered this error in Phpmyadmin, I tried MySQL-Front and successfully imported my database.

Note. You can use the provided solutions on this issue to solve your problem in Phpmyadmin.

0
Mar 05 '14 at 9:41
source share

If the answers above do not work, try checking your code. In my experience, having an infinite loop will also cause this problem. Check your else if statement.

0
Mar 30 '15 at 4:58
source share

In Codeignitor version 3.0.x, the /core/Codeigniter.php system does not contain a time limit and also inserts

 ini_set('MAX_EXECUTION_TIME', -1); 

will not work as codeignitor will override this with its own set_time_limit () function. Therefore, either you need to remove this function from codeignitor, or simply you can insert

 set_time_limit('1000'); 

at the beginning of the php file if you want to change it to 1000 seconds. Set the time to 0 (zero) if you want to run it as much as you want.

0
04 Oct '16 at 9:13
source share

In Xampp, in php.ini you should also check mysql.connect_timeout. So, for example, change it to:

 mysql.connect_timeout = 3600 

This time will always be counted in seconds (e.g. 1 hour in my example)

0
Nov 09 '16 at 8:04
source share

MAMP USERS editing php.ini solves this - there is a line:

max_execution_time = 30; The maximum execution time of each script, in seconds

setting this to a larger value.

the file is located in php / php5.6.25 / conf / php.ini (obviously, you need to wet the file for your version of php, you can find it from the MAMP settings.

0
Dec 02 '16 at 18:25
source share

For local AppServ

Go to C: \ AppServ \ www \ phpMyAdmin \ library \ config.default.php

Find $cfg['ExecTimeLimit'] and set the value to 0.

So it will look

 $cfg['ExecTimeLimit'] = 0; 
0
Jan 31 '18 at 1:32
source share

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. 
0
Jun 16 '19 at 7:27
source share

You can set a time limit:

 ini_set('max_execution_time', 1000000000000000); 
-one
Sep 29 '15 at 5:02
source share



All Articles