1

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

PHP Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 16384 bytes) in C:\xampp\htdocs\laravel\storage\framework\views\9ce6cdaa24325154033f80a71530d196495aafb3.php on line 2

Peyman Mohamadpour
  • 17,954
  • 24
  • 89
  • 100
Bhalaji G
  • 21
  • 1
  • 3
  • Does this answer your question? [Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 91 bytes) error while trying to backup database](https://stackoverflow.com/questions/34749239/fatal-error-allowed-memory-size-of-33554432-bytes-exhausted-tried-to-allocate) – catcon May 29 '20 at 06:05

2 Answers2

1

Unless you're intentionally working with multi-gigabyte data sets, you should not be exhausting 2 gigabytes of memory in a PHP script. While it's not ALWAYS a sign of unintended code execution, it USUALLY is.

Chances are you have some infinite loop or process that is just creating tons of data in memory. Look for while() loops in your code that create variables or append data to arrays or objects or append a string to a variable.

DO NOT just try to override the memory limit. That's like trying to deal with a serial killer by giving him more victims and hoping he runs out of steam.

jhilgeman
  • 1,543
  • 10
  • 27
-1

Before you decide how much memory you're about to use for your application, you can try to add the following line to the php function (DO NOT try this on production)

ini_set('memory_limit', '-1'); 

It's a memory limitation problem if the application could run as expected after adding above line of code

Noted: it is an easy (lazy) way to find out if the culprit is memory-using-problem but NOT A SOLUTION (still it's risky and not recommended in production).

Randy Lam
  • 579
  • 5
  • 11