Snippets

Fix allowed memory size exhausted in Laravel or Lumen

If you suddenly face PHP Fatal error: Allowed memory size of bytes exhausted (tried to allocate bytes) in Lumen or Laravel, there are few ways to solve this issue.

Most common ways to solve this issue by changing php.ini file. However, sometimes changing the value in php.ini file is troublesome.

#Alternative way.

The alternative way is just set the value COMPOSER_MEMORY_LIMIT=-1 in the terminal.

Imagine that, you are trying to install composer require ramsey/uuid and facing the issue of allowed memory issue. In that case, just run the command this way-

COMPOSER_MEMORY_LIMIT=-1
composer require ramsey/uuid

Now it should be working now.

Thanks.