• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

I Like Kill Nerds

The blog of Australian Front End / Aurelia Javascript Developer & brewing aficionado Dwayne Charrington // Aurelia.io Core Team member.

  • Home
  • Aurelia 2
  • Aurelia 1
  • About
  • Aurelia 2 Consulting/Freelance Work

PHP Composer "Fatal error: Allowed memory size of X bytes exhausted" Homebrew + Mac OS

General · September 14, 2014

I recently moved to a Mac and one of the first things I did was install Homebrew, then setup all of my PHP projects, one of them being a Laravel project which uses Composer for dependencies.

Then I hit a snag telling my I had exhausted my allowed memory allocation in my php.ini file. Well, shit.

The exact message I got was:

Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 32 bytes) in phar:///usr/local/Cellar/composer/1.0.0-alpha8/libexec/composer.phar/src/Composer/DependencyResolver/RuleWatchNode.php on line 40

Research seems to indicate this happens to a lot of people on Mac OS when using Laravel/Symfony. Numerous fixes have been pushed, but the issues still appears to exist for some (including myself).

I am using MAMP Pro for managing my local server stuff, so editing the php.ini file is a simple matter of going to: Menu -> File -> Edit Template ->php version and finding the memory_size directive.

If you are using something else for your local server, you will have to read the documentation to find out where your php.ini file is to bump up the allowed memory it can use.

In my php.ini file I bumped up the memory allowed to 1024M just in-case. It feels like a dirty hack, but I couldn’t find any other solution to get Composer to install my dependencies. I’ve never had this issue on Windows before, I guess, Mac’s are just more greedy.

Another fix you can try if the prospect of editing your php.ini file seems a little too daunting is the following:

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

Dwayne

Leave a Reply Cancel reply

3 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
boopa
boopa
7 years ago

Thanks.Its really helped for me.

0
aldorrman
aldorrman
7 years ago

Thanks!
Didn’t think I’d have to allocate that much memory. 1GB seems pretty ridiculous.
But it seems to have worked.
Now I’m just getting this error at the end:
Script php artisan clear-compiled handling the post-install-cmd event returned with an error
Any thoughts?
Cheers,
-aldorr

0

Primary Sidebar

Popular

  • Testing Event Listeners In Jest (Without Using A Library)
  • How To Get The Hash of A File In Node.js
  • How To Mock uuid In Jest
  • Which Neural DSP Archetype Plugins Should You Buy?
  • How to Copy Files Using the Copy Webpack Plugin (without copying the entire folder structure)
  • Removing A Character From The Start/End of a String In Javascript
  • How To Convert FormData To JSON Object
  • How To Correctly Use Semantic HTML5 <article>, <main> and <section> Tags
  • Wild Natural Deodorant Review
  • How to Use Neural DSP Archetype Plugins With the Quad Cortex

Recent Comments

  • Thebe on How to Remove the My Sites Menu From the WordPress Admin Bar
  • Maccas worker jn the 2000s on Dear McDonald’s: bring back the Warm Cookie Sundae, you cowards
  • Anamika Singh on Testing Event Listeners In Jest (Without Using A Library)
  • Stefan on A List of WordPress Gutenberg Core Blocks
  • pandammonium on A List of WordPress Gutenberg Core Blocks

Copyright © 2022 · Dwayne Charrington · Log in

wpDiscuz