laravel composer update runs out of memory

前端 未结 2 2016
生来不讨喜
生来不讨喜 2021-01-16 06:27

I am trying to update laravel repository using \'php composer.phar update\' command. But I am getting this error -

- Removing symfony/translation (v2.4.8)
PH         


        
相关标签:
2条回答
  • 2021-01-16 07:02

    I found out that some things can solve this problem -

    1) Update your PHP version. Versions prior to 5.4.19 don't work I think. But just keep it to the latest.

    2) Disable/Comment 'xdebug' in your php.ini file if its present. A link to disable it is present in the question.

    3) If non of the above works then try this one. This worked for me finally after wasting an hour or so.

    rm -rf vendor/
    
    rm -rf composer.lock
    
    php composer install --prefer-dist
    

    4) Rollback to a previous version of composer. It worked for some people. This might be a temporary solution ( because you definitely want to upgrade in future).

    5) This one was killer. This one also worked You can create a SWAP memory using your hard disk. This means that memory in hard disk will be used as additional RAM but the access to it would be slower (just like normal hard disk access). This is more useful for EC2 instance users who have very less RAM. More information for this is here -

    https://github.com/composer/composer/issues/945#issuecomment-12548720

    http://www.the-tech-tutorial.com/adding-swap-to-any-ec2-instance/

    0 讨论(0)
  • 2021-01-16 07:05

    The error you're seeing

    PHP Fatal error: Uncaught exception 'ErrorException' with message 'proc_open(): fork failed - Cannot allocate memory' in phar:///var/www/fyc/composer.phar/vend or/symfony/console/Symfony/Component/Console/Application.php:983

    Indicates the server literally ram out of RAM/memory and had to halt. Changing your PHP memory_limit won't solve this. When PHP fails because it hit its internal memory limit, you get a nice "tried to allocate XXX bytes of a total XXXXXX bytes" style error message.

    Composer can eat up a lot of memory when it's trying to resolve version dependencies. The three things I'd try here are

    1. Rename or delete your vendor folder and try re-installing instead of updating. Composer's sometimes better about memory when it's not trying to resolve a version dependency with existing installed versions

    2. Get a server with more memory

    3. Investigate what else may be eating up a lot of RAM on your server

    0 讨论(0)
提交回复
热议问题