admin管理员组

文章数量:1122832

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

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

Share Improve this question asked Nov 22, 2024 at 15:09 Alexandre Santos GomesAlexandre Santos Gomes 112 bronze badges 2
  • 2 2 thoughts: Are you sure that this isn't changed somewhere in your project? Are you sure that you have adjusted the correct php ini file? – Honk der Hase Commented Nov 22, 2024 at 15:13
  • Run phpinfo() through Laravel and check: 1) What INI files are parsed 2) What values for max_execution_time are reported. – Álvaro González Commented Nov 25, 2024 at 9:38
Add a comment  | 

2 Answers 2

Reset to default 0
  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

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:

xampp\apache\conf\httpd.conf 

or

xampp\apache\conf\extra\httpd-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.

本文标签: