EN
PHP - Fatal error: Maximum execution time of 30 seconds exceeded
4 points
In this short article we would like to show how to solve execution time problem when we got:
xxxxxxxxxx
1
Fatal error: Maximum execution time of 30 seconds exceeded
Quick solution:
xxxxxxxxxx
1
2
3
// put following line at beginning of your php file
4
set_time_limit(0);
5
6
// some php code here...
7
8
Note: it will change execution time only for currently run file.
Warning: below solution changes global php configuration !!!
As alternative we can set max_execution_time
to 0
in php.ini
file.
Simple steps:
1. find *.ini
file,
Run following command:
xxxxxxxxxx
1
find /etc -name "php.ini"
2
Output:
xxxxxxxxxx
1
/etc/php/5.6/cli/php.ini
2
/etc/php/5.6/apache2/php.ini
3
/etc/php/7.4/cli/php.ini
4
/etc/php/7.4/apache2/php.ini
2. edit proper file
e.g. run following command:
xxxxxxxxxx
1
nano /etc/php/7.4/apache2/php.ini
3. click ctrl
+w
, paste max_execution_time
and click enter to find the line,
4. set 0
as new value (0
means infinity), e.g.
xxxxxxxxxx
1
max_execution_time = 0
5. save the file with ctrl
+o
6. exit editor with ctrl
+x
Screenshot:
