I got this error when running composer.phar update
on my VM:
PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried t
When using the software Laragon on Windows, the following line helped me requiring a new package without getting the memory error:
php -d memory_limit=-1 "C:\laragon\bin\composer\composer.phar" require <insert package author here>/<insert package name here>
The only thing that solve my problem was doing this:
/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
/sbin/mkswap /var/swap.1
/sbin/swapon /var/swap.1
REF: COMPOSER TROUBLESHOOTING
I set memory_limit=-1 in my php.ini file but didnt work but i went ahead to execute commands from link below and then run composer install and worked perfectly
https://tecadmin.net/enable-swap-on-ubuntu/
this solution will fix your problem.
Update your php.ini file then restart Apache or your server example: memory_limit=128M to memory_limit=1128M
It's work on me.
Check the Composer's troubleshooting wiki, especially the memory limit errors section.
For instance, by running the composer like this:
php -d memory_limit=-1 `which composer` update
I get no error anymore. So it is probably an insufficient memory issue that can be solved inline, without altering your default PHP configuration.
What the command above does is that it sets the PHP CLI memory limit to "unlimited" (ie. -1) and then it runs the inline composer update
command.
Please note that instead of `which composer` you should probably use the real path of your composer.phar
PHP script. The which composer
written inline (like in my example above) will be inline solved to your composer.phar
full path (you may use whatever form you like).
You may also get resolved by just removing vendor directory and re-execute composer install command.