Fix Composer Memory Error - PHP Fatal error: Allowed memory size of xx bytes exhausted



I got this error while installing a Laravel package today and got it fixed so easily.

The exact error was this:

PHP Fatal error:  Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52

Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52

Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors. 


To fix this, you can either increase the memory limit for php, or ignore the memory limit for this command at the time you run this. I opted for the second method as I wanted to do this just one time.

Just run the same command as below:

php -d memory_limit=-1 <composer-bin-path> require <package-name>
Ex:
php -d memory_limit=-1 /usr/local/bin/composer require kreait/laravel-firebase

You can find the path for composer by using the following command. which composer
vagrant@homestead:~/$ which composer
/usr/local/bin/composer


Hope this will help someone.

2 comments :

  1. Life is always beautiful when you be with the true person you love. For almost a year my lover had broke up with me and I was lonely and sad luckily I was directed to a very little kind and Great spell caster called Dr Ralph who helped me to bring back my lover to me and today I am happy together and very grateful for what you have done for me, He can also help you cast spell like Love spells, Money spells, business improvement spell, Cure for any kind of disease and sickness, lottery winning spell and many others. You can contact him on his Email him via Ralphspellsolution@gmail.com or whatsApp on. +2347037816417.

    ReplyDelete
    Replies
    1. I have been married with my wife for 6 years and recently she broke up with me and it hurt me deeply when she told me to leave her alone and that she does not love me anymore when i was always faithful and honest to her. I tried all the ways to get her back buying her what she wants like i always did and she still left me heart broken and she even has a new boyfriend which destroyed me even more until a friend of mine from high school directed me to Dr Emu. This man changed my life completely. I followed everything he told me to do and my wife came back. I was stunned everything happened exactly like he told me. I had faith in everything he told me and everything was true. You can contact him via email: Emutemple@gmail.com He will help you in anything you need and quick to answer once you contact him through his whats-app number: +2347012841542
      For more destails about Dr Emu you can visit his Website: http://emutemple.website2.me/

      Delete