Fix “Fatal error: Allowed memory size of X bytes exhausted (tried to allocate X bytes)” with composer update

I got this error today when running composer update for one of my Symfony2 projects:

Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 3781182 bytes) in phar:///usr/local/bin/composer/src/Composer/Util/RemoteFilesystem.php on line 202

logo-composer-transparent

Composers troubleshooting tells that you can increase the memory PHP can allocate editing memory_limit parameter in php.ini. I changed it from 128M to 512M but still didn’t work.

Finally the solution was to run composer update with no memory limit like this:

php -d memory_limit=-1 /usr/local/bin/composer update

You might also like

“Uncaught exception ‘ErrorException’ with message ‘proc_open(): fork failed” with composer
I got this error while updating with composer:PHP Fatal error: Uncaught exception 'ErrorException'...

Update composer and all packages installed with it
php composer.phar self-update php composer.phar update...

Update composer and all packages installed with it
php composer.phar self-update php composer.phar update...

Fix “Cannot redeclare class Symfony…” in Symfony2 after upgrade
After upgrading from Symfony 2.2 to 2.3 I got this error in my application:Fatal error: Cannot redeclare...

  1. Do you know how to change it in capifony deploy script?

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.