Symfony 3.3.18: Composer Update/Install/Require fire => Out of memory

292 Views Asked by At

I'm trying to Upgrade a project from Symfony 3.3. I got this error when I run composer update, composer install after deleting composer.lock and composer require.

PHP Fatal error: Out of memory (allocated 1601437696) (tried to allocate 268435456 bytes) in phar://C:/Users/bbarhoum/Documents/ComposerSetup/bin/composer.phar/src/Composer/DependencyResolver/Solver.php on line 223

This is my composer.json:

{
    "name" : "symfony/framework-standard-edition",
    "license" : "MIT",
    "type" : "project",
    "description" : "The \"Symfony Standard Edition\" distribution",
    "autoload" : {
        "psr-0" : {
            "Detection" : "vendor/mobile-detect/namespaced"
        },
        "psr-4" : {
            "" : "src/"
        },
        "classmap" : [
            "app/AppKernel.php",
            "app/AppCache.php"
        ],
        "files" : [
            "vendor/wsdlwriter/classes/WsdlDefinition.php",
            "vendor/wsdlwriter/classes/WsdlWriter.php",
            "vendor/php-ga/src/autoload.php",
            "vendor/phpunit-selenium/PHPUnit/Extensions/SeleniumTestCase/Autoload.php",
            "vendor/htmlpurifier/library/HTMLPurifier.auto.php"
        ]
    },
    "require" : {
        "php" : ">=5.5.9",
        "symfony/symfony" : "3.3.*",
        "doctrine/orm" : "^2.5",
        "doctrine/doctrine-bundle" : "^1.6",
        "doctrine/doctrine-cache-bundle" : "^1.2",
        "symfony/swiftmailer-bundle" : "^2.3",
        "symfony/assetic-bundle" : "^2.3",
        "symfony/monolog-bundle" : "^3.0",
        "symfony/polyfill-apcu" : "^1.0",
        "sensio/distribution-bundle" : "^5.0",
        "sensio/framework-extra-bundle" : "^3.0.2",
        "incenteev/composer-parameter-handler" : "^2.0",
        "elasticsearch/elasticsearch" : "~5.0",
        "white-october/pagerfanta-bundle": "^1.2",
        "jasig/phpcas" : "1.3.5"
    },
    "require-dev" : {
        "sensio/generator-bundle" : "^3.0",
        "symfony/phpunit-bridge" : "^3.0",
        "doctrine/doctrine-fixtures-bundle" : "2.3.0",
        "phpunit/phpunit" : "5.5.*"
    },
    "scripts" : {
        "post-install-cmd" : [
            "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::removeSymfonyStandardFiles",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
        ],
        "post-update-cmd" : [
            "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::removeSymfonyStandardFiles",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
        ]
    },
    "config" : {
        "bin-dir" : "bin",
        "platform" : {
            "php" : "5.6.28"
        }
    },
    "minimum-stability" : "stable",
    "extra" : {
        "symfony-app-dir" : "app",
        "symfony-bin-dir" : "bin",
        "symfony-web-dir" : "web",
        "symfony-assets-install" : "relative",
        "incenteev-parameters" : {
            "file" : "app/config/parameters.yml"
        },
        "branch-alias" : {
            "dev-master" : "3.2-dev"
        }
    }
}

Composer diagnose:

Checking platform settings: OK 
Checking git settings: OK 
Checking http connectivity to packagist: OK 
Checking https connectivity to packagist: OK 
Checking HTTP proxy: OK 
Checking HTTP proxy support for request_fulluri: OK 
Checking HTTPS proxy support for request_fulluri: OK 
Checking github.com rate limit: OK 
Checking disk free space: OK 
Checking pubkeys: Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642 Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952 OK Checking composer version: OK 
Composer version:1.9.3 
PHP version: 5.6.28 - Package overridden via config.platform (actual: 5.6.30)
1

There are 1 best solutions below

0
alexcm On

Try running the command removing the memory limit of PHP.

php -d memory_limit=-1 composer update

You may need to use the absolute path for the composer exe.

If this doesn't work, check if your PHP version is for x86 or x64, and change to a x64 version if possible.

Also make sure that you have composer updated to the latest version, as it will improve the performance. composer self-update

Hope this helps as it did for me many times.