How do I enable error reporting in Laravel?
Asked Answered
I

3

7

I'm using Laravel 5.2 and I'm trying to import an excel sheet which contains more than 18000 records. the error below appeared. The localhost page isn’t working

localhost is currently unable to handle this request.
HTTP ERROR 500

I tried to change php.ini max_execution_time from 30 seconds to 300 seconds but nothing has been changed

EDIT

the apache error log file says: [:error] [pid 3680:tid 1724] [client ::1:54491] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 24 bytes) in E:\..............

Imprimatur answered 7/3, 2017 at 12:59 Comment(8)
What's the error log show?Courtesy
Check laravel logs if not then check apache logs....Wacke
"500 Internal Server Error" (or a blank page) means your script is throwing an error but PHP is configured to hide it from you. You need to fix it ASAP because coding without the aid of error messages is hard. As quick start, you can set the error_reporting and display_errors directives in your computer's system-wide php.ini file (details here). However, Laravel should have its own error reporting features—make sure you check them out in their documentation.Rossiya
the appache error log file says: [:error] [pid 3680:tid 1724] [client ::1:54491] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 24 bytes) in E:\\..............Imprimatur
you may need to increase your memory limit .Syllogism
how can I increase it please?Imprimatur
i've updated my answer with how to increase it .Syllogism
thanks all for your supportImprimatur
S
17

Through your config/app.php, set 'debug' => env('APP_DEBUG', false), to true.

Or in a better way, check out your .env file and make sure to set the debug element to true.

EDIT

According to the error in your apache2 log:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 24 bytes)

You need to increase your memory limit:

ini_set('memory_limit', XXX);
Syllogism answered 7/3, 2017 at 13:20 Comment(3)
where I can find ini_set please?Imprimatur
inside your method , be careful and change XXX to a valid value , check out more details about this in the manualSyllogism
changing in .env helped a lot especially if it is under gitignore, you wouldn't have worries of accidentally committing it to the repo.Santos
S
2

in .env file change APP_DEBUG to true

APP_DEBUG=true
Staphylorrhaphy answered 30/5, 2022 at 5:58 Comment(0)
O
1
ini_set('max_execution_time', 0);

set this at the start of your script, this will run your script forever and check your ipv4 address.

Oblique answered 7/3, 2017 at 13:10 Comment(2)
at the beginning of your scriptOblique
did you set your "debug" = true?Oblique

© 2022 - 2024 — McMap. All rights reserved.