I have the following set up:
In routes I have:
Route::get(\'articles\', \'ArticlesController@index\');
The index method in the controller is simply:<
I had a similar problem just now. However, this had nothing to do with modifying the php.ini
file. It was from a for loop. If you are having nested for
loops, make sure you are using the iterator properly. In my case, I was iterating the outer iterator from my inner iterator.
Sometimes you just need to optimize your code or query, Setting more max_execution_time is not a solution.
It is not suggested to take more than 30 for loading a webpage if a task takes more time need to be a queue.
Execution is not related to laravel go to the php.ini file In php.ini file set max_execution_time=360 (time may be variable depends on need) if you want to increase execution of a specific page then write ini_set('max_execution_time',360) at top of page
otherwise in htaccess php_value max_execution_time 360
The Maximum execution time of 30 seconds exceeded error is not related to Laravel but rather your PHP configuration.
Here is how you can fix it. The setting you will need to change is max_execution_time
.
;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;
max_execution_time = 30 ; Maximum execution time of each script, in seconds
max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
memory_limit = 8M ; Maximum amount of memory a script may consume (8MB)
You can change the max_execution_time
to 300
seconds like max_execution_time = 300
You can find the path of your PHP configuration file in the output of the phpinfo
function in the Loaded Configuration File
section.
If using PHP7, I would suggest you changing the default value in the public/.htaccess
<IfModule php7_module>
...
php_value max_execution_time 300
...
</IfModule>
You need to just press CTRL + F5. It will work after that.