Solve Symfony\Component\ErrorHandler\Error\FatalError Maximum execution time of 30 seconds exceeded

By: Roel
August 3, 2024

 When developing a Laravel application, especially in a local development environment like Laravel Herd, you might encounter the dreaded "Maximum execution time of 30 seconds exceeded" error. This error occurs when a script takes longer than PHP's default execution time limit of 30 seconds to complete.

Understanding the Error 

 By default, PHP scripts are allowed to run for a maximum of 30 seconds to prevent poorly written scripts from hogging server resources. However, legitimate scenarios like processing large datasets or performing complex calculations can sometimes exceed this limit. 

Solution: Modify php.ini

 The most straightforward way to increase the maximum execution time is by modifying the php.ini file. This file contains PHP configuration settings, including the max_execution_time directive. 

In Laravel Herd, this can be found in '%USERPROFILE%\.config\herd\bin\<version>\php.ini'  . Version is the php version you are using 

 Open the php.ini file in a text editor.   Find the line that sets max_execution_time: 

max_execution_time = 300

 Increase this value to a higher number, such as 300 seconds: 

max_execution_time = 300

This should solve the "maximum execution time exceeded" problem

About the Author

Roel
Roel

Hi, my name is Roel. I am a TALL stack developer. I created this site to document all web applications I created using the TALL stack. I exclusively built products using Laravel because I like the experience writing applications using the simplest framework/stack available.



Please login to comment.

© 2024 Talldevelopers.com, All rights reserved.