Languages
[Edit]
EN

PHP - Fatal error: Maximum execution time of 30 seconds exceeded

4 points
Created by:
Isaiah89
721

In this short article we would like to show how to solve execution time problem when we got:

Fatal error: Maximum execution time of 30 seconds exceeded

 Quick solution:

<?php

    // put following line at beginning of your php file
    set_time_limit(0);

    // some php code here...

?>

Note: it will change execution time only for currently run file.

Alternative solution

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:

find /etc -name "php.ini"

Output:

/etc/php/5.6/cli/php.ini
/etc/php/5.6/apache2/php.ini
/etc/php/7.4/cli/php.ini
/etc/php/7.4/apache2/php.ini

2. edit proper file

e.g. run following command:

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.

max_execution_time = 0

5. save the file with ctrl+o 

6. exit editor with ctrl+x 

Screenshot:

Solution for: Fatal error: Maximum execution time of 30 seconds exceeded
Solution for: Fatal error: Maximum execution time of 30 seconds exceeded
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join