In general, the default PHP
program maximum run time is 30s
, if your program runs more than this time limit, then there will be a similar Maximum execution time of 30 seconds exceeded
error.
There are several workarounds:
First check whether you are doing something stupid, which consumes a lot of CPU resources and time, if you really need the program for a long time to run to produce results, then you can
1> php.ini
increased run time in:
max_execution_time=300
2> PHP
Add the following code to the file
Ini_set (' Max_execution_time ', 300); seconds = 5 minutes
3> using .htaccess
files to increase run time:
<ifmodule mod_php5.c> php_value max_execution_time 300</ifmodule>
Some other common configuration references:
<ifmodule mod_php5.c> php_value post_max_size 5M php_value upload_max_filesize 5M php_value Memory _limit 128M php_value max_execution_time php_value max_input_time php_value Maxlifetime 1200</ifmodule>
If your environment is wordpress
, then please in config.php
, add:
Define (' Wp_memory_limit ', ' 128M ');
If you use some other framework, you can modify
ini_set(‘memory_limit‘, ‘128M‘);
By default,The maximum execution time configured in php.ini is 30 seconds, which is specified by the max_execution_time variable in php.ini. If we have a job that takes a lot of time, like sending a lot of mail, or doing a huge amount of statistical analysis work. Even if the task is not completed, the server will forcibly abort the executing program after 30 seconds.
1, two methods for modifying the maximum execution time(1) Direct modification The value of Max_execution_time in php.ini.
(2) If you do not have permission to modifyphp.ini file, or we want to set up some pages individually. It can also be set in the PHP program page, the code is as follows ( number 0 indicates no execution time limit ).
1 |
ini_set ( ‘max_execution_time‘ , ‘0‘ ); |
2, if you are using an IIS server, remember to also modify the "Active timeout" time
If you are running a PHP program under the IIS service , you will find that the previous method has been modified to perform a lengthy operation or error. The error message is as follows: HTTP Error 500.0-internal Server error
The C:\websoft\php\php-cgi.exe-FastCGI process exceeded the configured request timeout
Workaround: FastCGI Settings, IIS--double-clickactivity Timeout, php-cgi.exe, to increase this value as needed.
Original from: www.hangge.com reprint please keep the original link: http://www.hangge.com/blog/cache/detail_1369.html
Set PHP maximum run time