skip to Main Content

I’m using PHP 8.2.12 and Laravel 9.52.16, and even setting max_execution_time to 300, restarting XAMPP, and restarting the computer, if the project takes more than 60 seconds to load, the maximum execution time error occurs. How do I fix this?

P.S.: I’m using a localhost project

2

Answers


    1. Set excution_time at PHP config file
    2. Set excution_time at Xampp server
    3. Sometimes your brower will close automatically when request take time is too long -> use curl, postman to send request, or think about queue in laravel
    Login or Signup to reply.
  1. You need to do more steps to figure out if it not working even after changing the MAX_EXECUTION_TIME value.

    1. As you are using Laravel so use the following code in your /routes/web.php file:
    Route::get('/phpinfo', function () {
        return phpinfo();
    });
    

    Then, test this above added route like (modify it according to your url and port:

    http://locahost:8000/phpinfo
    
    1. Look for the "Loaded Configuration File" to confirm the active php.ini path and change the value of
    max_execution_time = 300
    

    After you have done the changes in php.ini file, you must restart your XAMPP server.

    1. To identify the active value of max_execution_time use the following code:
    dd(ini_get('max_execution_time'));
    
    
    1. The Apache server might have a timeout configuration that overrides PHP’s max_execution_time. You need to locate your Apache configuration file according to your operating system

    Windows:

    xamppapacheconfhttpd.conf 
    

    or

    xamppapacheconfextrahttpd-xampp.conf
    

    Search for the Timeout directive and set it to a higher value:

    Timeout 300
    

    Also restart Apache.

    The above steps will help you to fix this MAX_EXECUTION_TIME issue.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search