Languages
[Edit]
EN

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

4 points
Created by:
Marcin
2478

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
Hey ūüĎč
Would you like to know what we do?
  • Dirask is a friendly IT community for learners, professionals and hobbyists to share their knowledge and help each other in extraordinary easy way.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.