Skip to content

Instantly share code, notes, and snippets.

@NickDeckerDevs
Created April 19, 2018 10:13
Show Gist options
  • Select an option

  • Save NickDeckerDevs/97f50d4c0e9aa1002ac3c2bc25587993 to your computer and use it in GitHub Desktop.

Select an option

Save NickDeckerDevs/97f50d4c0e9aa1002ac3c2bc25587993 to your computer and use it in GitHub Desktop.
Fixing issues with OSX Memory Limit in PHP for errors - composer
# Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 3582064 bytes) in phar:///usr/local/bin/wp/vendor/composer/composer/src/Composer/Cache.php on line 92
# Reverted composer.json.
# lets figure out why this is happening. If you are using regular command line, it is most likely controlled
# via the system and not mamp or anything, unless you have a different shell setup. So we need to adjust the
# system PHP
php -i | grep memory
# output may look like [memory_limit => 128M => 128M]
# lets change that to 512
## First find out where php.ini lives
php -i | grep php.ini
# output may look like [Configuration File (php.ini) Path => /etc] -- it could be multiple lines.
# So we may need to trackdown each of these
# for the example above (most likely default) we need can
cd /etc
ls -d php*
# output [php-fpm.conf.default php-fpm.d php.ini.default]
# If this is the case, we need to copy php.ini.default to php.ini
# you most likely need to sudo this.
sudo cp /etc/php.ini.defautl /etc/php.ini
# if your php.ini file already exists then we don't need the above. We can just edit it.
# edit your file. you will need sudo. sudo nano /etc/php.ini sudo atom /etc/php.ini -- just edit it
atom /etc/php.ini
# search for memory limit, change that to 512, save your file and get back to the command line!
# probably need sudo on this command. We need to restart OSX apache
sudo apachectl restart
@heyflorin

Copy link
Copy Markdown

You sir, are a light in a sea of darkness. Thank for posting this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment