Fix allowed memory size exhausted in Laravel or Lumen

3 years ago
5801 views

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.

Thouhedu Islam Suchi

Thouhedul Islam

Laravel Developer

Hi, I am a Laravel Developer with a passion for web development. I specialize in PHP, particularly Laravel, as well as Javascript, MySql, and other cutting-edge web technologies.

During the day, I work for GLEIF, where I apply my skills and experience to develop innovative web applications. At night, I enjoy contributing to the community and solving problems. You can often find me on Laracasts, where I love to stay active and keep up-to-date with the latest trends in web development.

I am excited about the potential of technology and its power to transform people's lives.