Gustin Tang
Gustin Tang

Reputation: 85

Problem Composer `Memory limit` with Capistrano and Symfony 3.3 in AWS VM

I've a problem with my composer and capistrano when i lauch the command i've got :

Problem 1
    - Installation request for symfony/symfony v3.3.17 -> satisfiable by symfony/symfony[v3.3.17].
    - don't install symfony/var-dumper v4.0.12|don't install symfony/symfony v3.3.17
    - Installation request for symfony/var-dumper v4.0.12 -> satisfiable by symfony/var-dumper[v4.0.12].

Here's my composer.json :

{
  "name": "mickaelmonsang/showroom",
  "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",
    "cocur/slugify": "^3.1",
    "composer/ca-bundle": "^1.1",
    "doctrine/annotations": "^1.6",
    "doctrine/cache": "^1.7",
    "doctrine/doctrine-bundle": "^1.9",
    "doctrine/doctrine-cache-bundle": "^1.3",
    "doctrine/doctrine-migrations-bundle": "^1.0",
    "doctrine/inflector": "^1.3",
    "doctrine/migrations": "^1.8",
    "doctrine/orm": "^2.5",
    "doctrine/reflection": "^1.0",
    "friendsofsymfony/user-bundle": "^2.1",
    "gedmo/doctrine-extensions": "^2.4",
    "guzzlehttp/guzzle": "^6.3",
    "hwi/oauth-bundle": "^0.5.3",
    "incenteev/composer-parameter-handler": "^2.1",
    "knplabs/gaufrette": "^0.6.0",
    "knplabs/knp-components": "^1.3",
    "knplabs/knp-gaufrette-bundle": "^0.5.3",
    "knplabs/knp-menu": "^2.3",
    "knplabs/knp-menu-bundle": "^2.2",
    "knplabs/knp-paginator-bundle": "^2.8",
    "kriswallsmith/buzz": "0.16.1",
    "league/oauth2-client": "^2.3",
    "ocramius/package-versions": "^1.3",
    "paragonie/random_compat": "2.0.17",
    "psr/simple-cache": "^1.0",
    "sensio/distribution-bundle": "^5.0",
    "sensio/framework-extra-bundle": "3.0.29",
    "sensio/generator-bundle": "^3.1",
    "sensiolabs/security-checker": "^4.1",
    "sonata-project/admin-bundle": "3.36.0",
    "sonata-project/block-bundle": "^3.12",
    "sonata-project/cache": "^2.0",
    "sonata-project/core-bundle": "^3.11",
    "sonata-project/datagrid-bundle": "^2.3",
    "sonata-project/doctrine-orm-admin-bundle": "3.6.1",
    "sonata-project/exporter": "^1.9",
    "stof/doctrine-extensions-bundle": "^1.3",
    "swiftmailer/swiftmailer": "5.4.9",
    "symfony/assetic-bundle": "^2.8",
    "symfony/monolog-bundle": "3.2.0",
    "symfony/phpunit-bridge": "^4.1",
    "symfony/polyfill-apcu": "^1.8",
    "symfony/polyfill-intl-icu": "^1.8",
    "symfony/polyfill-mbstring": "^1.8",
    "symfony/polyfill-php56": "^1.8",
    "symfony/polyfill-php70": "^1.8",
    "symfony/polyfill-php72": "^1.8",
    "symfony/polyfill-util": "^1.8",
    "symfony/security-acl": "3.0.1",
    "symfony/swiftmailer-bundle": "2.6.7",
    "symfony/symfony": "3.3.17",
    "symfony/var-dumper": "4.0.12",
    "twig/twig": "^2.5",
    "vich/uploader-bundle": "1.7.1",
    "zendframework/zend-eventmanager": "^3.2"
  },
  "require-dev": {
  },
  "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
  }
}

and when i want to install any bundle with composer i've got an error :

mmap() failed: [12] Cannot allocate memory
PHP Fatal error:  Out of memory (allocated 343932928) (tried to allocate 1560576 bytes)

or I've set the PHP memory_limit to -1 and restart by nothing.

What's wrong so ?

Notice : I'm on PHP7.0

Hope you've got the solution :).

Upvotes: 0

Views: 518

Answers (2)

xabbuh
xabbuh

Reputation: 5881

The symfony/symfony package already includes the VarDumper component (which you try to install with the symfony/var-dumper package). This is something Composer wrongly allowed in older versions and was fixed in Composer 1.7.3.

Do you really need the VarDumper component in version 4? If that's the case, you need to remove symfony/symfony first and require all the needed components explicitly if you cannot upgrade all Symfony packages to 4.

Upvotes: 1

Niall Lonergan
Niall Lonergan

Reputation: 901

There's both a short-term and a long-term solution,

Short-term: Paste in to your php file.

ini_set('memory_limit', '256M');

Long-term: Change the default value in the php.ini file to the below.

memory_limit = 256M

For more information on this issue, take a look at this thread here.

Upvotes: 0

Related Questions