The following tutorial column will introduce you to Composer 2. It can really reduce or avoid fatal errors of insufficient memory. I hope it will be helpful to friends in need!
Today I plan to update a project to Laravel 8. After adjusting the dependency version, when runningcomposer update, the damn thing about memory The fatal error of not being enough appears again:
PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes)
It feels like it can never be satisfied. I reflexively looked for a solution first. Of course I knew what to do, but I forgot the order. During the search process, I was reminded of Composer 2
. I remember that it was said to have "smaller memory footprint", and it is very convenient to upgrade and roll back the version. You might as well give it a try and upgrade it immediately:
composer self-update --2 Updating to version 2.0.8 (2.x channel). Downloading (100%) Use composer self-update --rollback to return to version 1.10.19
The upgrade is completed in the gap, and then the update package command is executed. This time no error is reported, and the packages start to be installed one by one. Through the use of this package installation, I have some intuitive feelings:
The above is the detailed content of Can Composer2 reduce or avoid fatal errors due to insufficient memory?. For more information, please follow other related articles on the PHP Chinese website!