skip to Main Content

On my Symfony project, I have some error when running composer update/install command:

This is the error occured when I run composer:

Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried
to allocate 524288 bytes) in
phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Util/RemoteFilesystem.php
on line 189

enter image description here

As you can see I run the prompt command as administrator, but even if I run the command as not admin, the same error occured.

I also check the page here in order to set the change they recommand me to run composer without troubles.

I am on Windows 10 and using wamp server for my project.
So in my php.ini i wrote this line: memory_limit = 2G

I restart wamp and so my computer in order to be sure. And when I run the command php -r "echo ini_get('memory_limit').PHP_EOL;" it always show 128M.

If I run composer diagnose command this is what I get from the prompt command :
enter image description here

As you can see here, composer show me an error on my composer.json.
This my composer.json file:

{
    "name": "symfony/framework-standard-edition",
    "license": "MIT",
    "type": "project",
    "description": "The "Symfony Standard Edition" distribution",
    "autoload": {
        "psr-4": { "": "src/" }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "require": {
        "php": ">=5.3.9",
        "symfony/symfony": "2.7.*",
        "doctrine/orm": "^2.4.8",
        "doctrine/doctrine-bundle": "~1.4",
        "symfony/assetic-bundle": "~2.3",
        "symfony/swiftmailer-bundle": "~2.3",
        "symfony/monolog-bundle": "~2.4",
        "sensio/distribution-bundle": "~4.0",
        "sensio/framework-extra-bundle": "^3.0.2",
        "incenteev/composer-parameter-handler": "~2.0",
        "friendsofsymfony/user-bundle": "~2.0",
        "knplabs/doctrine-behaviors": "~1.1",
        "friendsofsymfony/jsrouting-bundle": "^1.5",
        "jms/serializer-bundle": "^1.1",
        "sonata-project/seo-bundle": "^2.0",
        "genemu/form-bundle": "2.2.*",
        "elao/web-profiler-extra-bundle" : "~2.3@dev",
        "maxmind/geoip": "dev-master",
        "a2lix/translation-form-bundle": "^2.0",
        "ircmaxell/password-compat": "^1.0",
        "sonata-project/translation-bundle": "^1.0",
        "sp/bower-bundle": "^0.11.0",
        "ensepar/html2pdf-bundle" : "~2.0"
    },
    "require-dev": {
        "sensio/generator-bundle": "~2.3",
        "doctrine/doctrine-fixtures-bundle": "^2.3"
    },
    "scripts": {
        "pre-install-cmd": [
            "BetonDirect\EntityBundle\HerokuDatabase::populateEnvironment"
        ],
        "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::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::prepareDeploymentTarget"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "symfony-assets-install": "hard-copy",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml",
            "env-map": {
                "database_driver": "DATABASE_DRIVER",
                "database_host": "DATABASE_HOST",
                "database_port": "DATABASE_PORT",
                "database_name": "DATABASE_NAME",
                "database_user": "DATABASE_USER",
                "database_password": "DATABASE_PASSWORD"
            }
        },
        "branch-alias": {
            "dev-master": "2.7-dev"
        }
    }
}

I also disable in my wamp ,server xdebug zend extension, but it does not work too (same problem when I change the memory_limit, nothing change).

If you have some issues, I appreciate.

3

Answers


  1. You are editing the wrong php ini

    To find out which php.ini you have to edit for cli

    in cmd type php -i

    and search for php.ini

    or place echo phpinfo()

    in RemoteFilesystem.php on line 180 or whatever and search stdout for php.ini

    Login or Signup to reply.
  2. it seems like you have the 32bit PHP version installed for Windows, the memory limit is 2GB here. You can install 64bit PHP version and have a memory limit of 4GB which should be enough.

    Here is a tutorial:

    http://sebastianviereck.de/en/Windows-composer-update-fatal-error-allowed-memory-size-of-1610612736-bytes-exhausted/

    Login or Signup to reply.
  3. This is the solution in windows 10

    php -d memory_limit=-1 C:/ProgramData/ComposerSetup/bin/composer.phar update
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search