• 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

[FIX] ‘Allowed memory size exhausted’ Composer PHP On Mac OSX

PHP · September 26, 2014

Recently I encountered a dreaded issue whilst trying to install Laravel on my Mac OSX machine.

The message I was getting was:

Allowed memory size of 536870912 bytes exhausted (tried to allocate 72 bytes) in phar:///usr/local/Cellar/composer/1.0.0-alpha8/libexec/composer.phar/src/Composer/DependencyResolver/RuleSetGenerator.php on line 123

The issue was perplexing according to PHP I had allocated 128mb of memory for PHP, but apparently this wasn’t enough. It appears as though dependencies are managed within memory and all of the components that make up Laravel (mostly Symfony) take up more than 128mb of memory.

I am using MAMP for my local development environment and setting the memory to be higher in my PHP.ini file (even though my MAMP PHP is used as the default) didn’t change the memory size, so I had to try something else.

If you are using your Homebrew install of Composer, you need to actually download the .phar file instead. I found that the Homebrew install of Composer didn’t allow you (from what I could find) to specify memory usage.

Download Composer.phar

If you haven’t already downloaded Composer (the .phar file version) in your application directory you will want to run this: curl -sS https://getcomposer.org/installer | php

You will now have the Composer package manager file to run. We will be calling it like a PHP script.

Running Composer.phar

To run Composer without memory restrictions simply type: php -d memory_limit=-1 composer.phar update

Your application that was previously freaking out because of memory exhaustion will now run (hopefully).

 

Dwayne

Leave a Reply Cancel reply

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Bright
Bright
6 years ago

Super. Thank you so much 😀

0

Primary Sidebar

Popular

  • Testing Event Listeners In Jest (Without Using A Library)
  • How To Get The Hash of A File In Node.js
  • Waiting for an Element to Exist With JavaScript
  • Thoughts on the Flipper Zero
  • How To Get Last 4 Digits of A Credit Card Number in Javascript
  • How To Paginate An Array In Javascript
  • How To Mock uuid In Jest
  • How to Copy Files Using the Copy Webpack Plugin (without copying the entire folder structure)
  • Reliably waiting for network responses in Playwright
  • Wild Natural Deodorant Review

Recent Comments

  • Dwayne on Is Asking Developers How to Write FizzBuzz Outdated?
  • kevmeister68 on Is Asking Developers How to Write FizzBuzz Outdated?
  • 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

Copyright © 2023 · Dwayne Charrington · Log in

wpDiscuz