• 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
8 years ago

Thanks.Its really helped for me.

0
aldorrman
aldorrman
8 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
  • Thoughts on the Flipper Zero
  • Waiting for an Element to Exist With JavaScript
  • How To Paginate An Array In Javascript
  • How To Mock uuid In Jest
  • How To Get Last 4 Digits of A Credit Card Number in Javascript
  • How to Use Neural DSP Archetype Plugins With the Quad Cortex
  • How To Decompile And Compile Android APK's On A Mac Using Apktool
  • NBN Box Installed Inside of Garage, Where Do You Put The Modem?

Recent Comments

  • Kevmeister68 on Start-Ups and Companies That Embrace Work From Anywhere Will Be More Likely to Survive the Coming Recession in 2023
  • kevmeister68 on What Would Get People Back Into the Office?
  • Dwayne on PHP Will Not Die
  • Dwayne on How to Create a Blockchain With TypeScript
  • kevmeister68 on PHP Will Not Die

Copyright © 2023 · Dwayne Charrington · Log in

wpDiscuz