Fix "Allowed memory size of X bytes exhausted" - Kevin McKee
Published on

Fix "Allowed memory size of X bytes exhausted"

Author

Recently as I've been trying to add packages in my local environment I keep getting error messages like the following:

composer require iamkevinmckee/single-database-tenancy

PHP Fatal error:  Allowed memory size of 1610612736 bytes exhausted

This gets very frustrating and I haven't had time to find a permanent solution, but I have found a workaround. If you change your command to the following it will work:

php -d memory_limit=-1 /usr/local/bin/composer require iamkevinmckee/single-database-tenancy

If I figure out how to fix this permanently, I will update this post. Thanks to Snapey for figuring this one out on the Laracasts forums

https://laracasts.com/discuss/channels/laravel/allowed-memory-size-of-1610612736-bytes-exhausted-tried-to-allocate-4096-bytes

Want to talk about this post? Connect with me on Twitter →