How to Increase Maximum Execution Time in PHP

How to increase maximum execution time in php

ini_set('max_execution_time', '300'); //300 seconds = 5 minutes
ini_set('max_execution_time', '0'); // for infinite time of execution

Place this at the top of your PHP script and let your script loose!

Taken from Increase PHP Script Execution Time Limit Using ini_set()

Set maximum execution time in PHP

You can use 0 :

max_execution_time = 0     

That will disabled the limitation. Don't forget to restart apache after.

You can also user the PHP version :

<?php set_time_limit(0); ?>

How to increase the execution timeout in php?

You need to change some settings in your php.ini:

upload_max_filesize = 2M 
;or whatever size you want

max_execution_time = 60
; also, higher if you must - sets the maximum time in seconds

Where your PHP.ini is located depends on your system environment. For more information: http://php.net/manual/en/ini.list.php

Set maximum execution time in MYSQL / PHP

You can make it by setting set_time_limit in you php code (set to 0 for no limit)

set_time_limit(0);

Or modifying the value of max_execution_time directly in your php.ini

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 120

Or changing it with ini_set()

ini_set('max_execution_time', 120); //120 seconds

but note that for this 3rd option :

max_execution_time

You can not change this setting with ini_set() when running in safe
mode. The only workaround is to turn off safe mode or by changing the
time limit in the php.ini.

Source www.php.net

Increase PHP Script Execution Time

Try set_time_limit(0); at the top of your script.

set_time_limit sets the maximum execution time in seconds. If set to zero, no time limit is imposed (see PHP manual).

WAMPServer phpMyadmin Maximum execution time of 360 seconds exceeded

A better solution here is to change the config that controls phpMyAdmin and not the php.ini file.

If you change the php.ini file you effect everything in PHP and should you write that infinite loop that we all do from time to time it will take longer to terminate your infinite loop than is sensible.

Note: If you are using the 64bit WAMPServer the base folder name will be wamp64 instead of wamp so please amend the below folder names accordingly.

So change \wamp\alias\phpmyadmin.conf. By default it will look something like this although your version of phpMyAdmin will probably be different:

Alias /phpmyadmin "c:/wamp/apps/phpmyadmin4.1.14/"

<Directory "c:/wamp/apps/phpmyadmin4.1.14/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
<IfDefine APACHE24>
Require local
</IfDefine>
<IfDefine !APACHE24>
Order Deny,Allow
Deny from all
Allow from localhost ::1 127.0.0.1
</IfDefine>
php_admin_value upload_max_filesize 128M
php_admin_value post_max_size 128M
php_admin_value max_execution_time 360
php_admin_value max_input_time 360
</Directory>

To extend the maximum time limit for importing a database, change the php_admin_value max_execution_time parameter. You may also need to change the other parameters as larger databases tend to come in larger files and take longer to read as well. Example:

  php_admin_value upload_max_filesize 1024M
php_admin_value post_max_size 1024M
php_admin_value max_execution_time 1800
php_admin_value max_input_time 1800

Don't forget to restart Apache after making changes to this file.

Fatal error: Maximum execution time of 30 seconds exceeded

Your loop might be endless. If it is not, you could extend the maximum execution time like this:

ini_set('max_execution_time', '300'); //300 seconds = 5 minutes

and

set_time_limit(300);

can be used to temporarily extend the time limit.



Related Topics



Leave a reply



Submit