Composer update => Fatal error: Out of memory

血红的双手。 提交于 2019-12-23 13:23:08

问题


I'm using XAMPP on a local machine. I couldn't solve this issue by removing the PHP memory limit.

What I already tried :

  • modified my php.ini to remove the memory limit => memory_limit=-1

  • Checked I was running PHP 5.6

  • and self-updated composer to the last version

But it doesn't seem to have any effect at all. Does anyone have a suggestion?

My composer.json:

{
    "name": "erwin/symff",
    "license": "proprietary",
    "type": "project",
    "autoload": {
        "psr-4": {
            "AppBundle\\": "src/AppBundle"
        },
        "classmap": [
            "app/AppKernel.php",
            "app/AppCache.php"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        },
        "files": [
            "vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php"
        ]
    },
    "require": {
        "php": ">=5.5.9",
        "bmatzner/fontawesome-bundle": "~4.4",
        "bmatzner/jquery-bundle": "~1.9",
        "bmatzner/jquery-mobile-bundle": "~1.4.5",
        "bmatzner/jquery-ui-bundle": "~1.10.3",
        "boekkooi/jquery-validation-bundle": "~1.2.1",
        "divi/ajax-login-bundle": "dev-master",
        "doctrine/doctrine-bundle": "^1.6",
        "doctrine/doctrine-fixtures-bundle": "^3.0.2",
        "doctrine/orm": "^2.5",
        "egeloen/google-map-bundle": "^3.0.1",
        "egeloen/serializer-bundle": "^1.0.0",
        "friendsofsymfony/comment-bundle": "^2.2.0",
        "friendsofsymfony/jsrouting-bundle": "^2.2.1",
        "friendsofsymfony/user-bundle": "^2.1.2",
        "incenteev/composer-parameter-handler": "^2.0",
        "ivkos/pushbullet": "^3.3.0",
        "javiereguiluz/easyadmin-bundle": "^1.17",
        "jmose/command-scheduler-bundle": "^2.0.0",
        "jms/security-extra-bundle": "^1.6.1",
        "php-http/guzzle6-adapter": "^1.1.1",
        "php-http/httplug-bundle": "^1.11.0",
        "rapidwebltd/php-google-contacts-v3-api": "^2.0.0",
        "sensio/distribution-bundle": "^5.0.19",
        "sensio/framework-extra-bundle": "^3.0.2",
        "symfony/assetic-bundle": "dev-master",
        "symfony/monolog-bundle": "^3.1.0",
        "symfony/polyfill-apcu": "^1.0",
        "symfony/swiftmailer-bundle": "^2.3.10",
        "symfony/symfony": "3.4.*",
        "twig/extensions": "1.0.*",
        "twig/twig": "^1.0||^2.0",
        "vich/uploader-bundle": "^1.0.1"
    },
    "require-dev": {
        "sensio/generator-bundle": "^3.0",
        "symfony/phpunit-bridge": "^3.0"
    },
    "scripts": {
        "symfony-scripts": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
        ],
        "post-install-cmd": [
            "@symfony-scripts"
        ],
        "post-update-cmd": [
            "@symfony-scripts"
        ]
    },
    "config": {
        "sort-packages": true
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-bin-dir": "bin",
        "symfony-var-dir": "var",
        "symfony-web-dir": "web",
        "symfony-tests-dir": "tests",
        "symfony-assets-install": "relative",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
        "branch-alias": null
    }
}

When I run this command:

composer update

I get the following output:

"C:\DEV\xampp\php\php.exe" "C:\DEV\xampp\htdocs\symfony\composer.phar" "--ansi" "--no-interaction" "update"
Loading composer repositories with package information
Updating dependencies (including require-dev)

Fatal error: Out of memory (allocated 1584922624) (tried to allocate 268435456 bytes) in phar://C:/DEV/xampp/htdocs/symfony/composer.phar/src/Composer/DependencyResolver/Solver.php on line 220
PHP Fatal error:  Out of memory (allocated 1584922624) (tried to allocate 268435456 bytes) in phar://C:/DEV/xampp/htdocs/symfony/composer.phar/src/Composer/DependencyResolver/Solver.php on line 220

And I expected this to happen:

A simple update as used to happen earlier.

EDIT :

From what I understand, the "Out of memory" error seems to indicate a physical memory limit and not a configured one.

PHP on windows is 32bits (I think so at least...) and 32Bit Processes cannot use more than 2GB of RAM.

So I guess I'm hitting a real physical limitation.

My question now would be : How can I still update my packages on a 32bits PHP ?

I tried updating on a per package approach

C:\DEV\xampp\htdocs\symfony>php -d memory_limit=-1 composer.phar update bmatzner/fontawesome-bundle
Loading composer repositories with package information
Updating dependencies (including require-dev)
PHP Fatal error:  Out of memory (allocated 1592000512) (tried to allocate 268435456 bytes) in phar://C:/DEV/xampp/htdocs/symfony/composer.phar/src/Composer/DependencyResolver/Solver.php on line 220

but as you can see, I encounter the same problem.


回答1:


Upgrading to PHP7 did the trick.

It seems more efficient when it comes to RAM consumption.

Thanks to everyone who tried to help me here.




回答2:


update composer with larger memory limit

php -dmemory_limit=3G /usr/local/bin/composer update



来源:https://stackoverflow.com/questions/52570879/composer-update-fatal-error-out-of-memory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!