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:\..............

charliefortune
  • 3,072
  • 5
  • 28
  • 48
Mohamed Shawky
  • 807
  • 2
  • 8
  • 14
  • What's the error log show? – chris85 Mar 07 '17 at 13:02
  • Check laravel logs if not then check apache logs.... – Naincy Mar 07 '17 at 13:09
  • 1
    "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](http://stackoverflow.com/a/5680885/13508)). However, Laravel should have its own error reporting features—make sure you check them out in their documentation. – Álvaro González Mar 07 '17 at 13:12
  • 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:\\.............. – Mohamed Shawky Mar 07 '17 at 13:21
  • you may need to increase your memory limit . – hassan Mar 07 '17 at 13:25
  • how can I increase it please? – Mohamed Shawky Mar 07 '17 at 13:26
  • i've updated my answer with how to increase it . – hassan Mar 07 '17 at 13:30
  • thanks all for your support – Mohamed Shawky Mar 07 '17 at 14:05

3 Answers3

15

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);
Mahmoud Abdelsattar
  • 1,299
  • 1
  • 15
  • 31
hassan
  • 7,812
  • 2
  • 25
  • 36
  • where I can find ini_set please? – Mohamed Shawky Mar 07 '17 at 13:38
  • inside your method , be careful and change `XXX` to a valid value , check out more details about this in the [manual](http://php.net/manual/en/ini.core.php#ini.sect.resource-limits) – hassan Mar 07 '17 at 13:49
  • changing in .env helped a lot especially if it is under gitignore, you wouldn't have worries of accidentally committing it to the repo. – Jacobski May 20 '21 at 06:02
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.

Sweta Parmar
  • 269
  • 1
  • 11
0

in .env file change APP_DEBUG to true

APP_DEBUG=true
Wasim A.
  • 9,660
  • 22
  • 90
  • 120