Drupal 8 - Composer - lack of memory


~/composer.phar --profile install


L'ajout de module Drupal 8 passe avec ta procédure, sur mon Cloud Web 2 GB (sans le swap file).
Mais je vais encore refaire un test.

Avec ta procédure, je n'ai pas la même structure de dossiers Drupal.
ça me dérange un peu (mais ce n'est pas "mortel"), car moins bien organisé
et aussi car je crois que lors d'un "composer update", ça ne mettra pas à jour les fichiers à la racine Drupal.
(il y a des expli sur cela sur le site Drupal)

MAIS... je me demande si mon problème ne vient pas du fait que j'ai fait ma commande "composer" pour installer Drupal 8.4.0
mais JAMAIS fait la commande

**~/composer.phar --profile install**

Je vais refaire ma procédure, mais en ajoutant ça !
Si c'est ça mon erreur, alors Composer consommerait nettement moins.

Je refais ce test et je vous tient au courant.

Merci. Didier

Bonjour,

sinon il reste les options B et C de la doc drupal (visiblement la C est équivalente à la A en terme de "fonctionnalités").

Cordialement, janus57

je refais ma procédure complète pour Drupal 8.4.0<br />mais sur mon Cloud Web avec 2 GB (sans swap file) :<br /><br />    **~/composer create-project drupal-composer/drupal-project:8.x-dev cloudweb2 --stability dev --no-interaction**<br /><br />    Installing drupal-composer/drupal-project (8.x-dev 6418a08f89b7580d1a51f47cb0f08afc0bd572e7)<br />      - Installing drupal-composer/drupal-project (8.x-dev 6418a08): Cloning 6418a08f89<br />    Created project in cloudweb2<br />    &gt; DrupalProject\composer\ScriptHandler::checkComposerVersion<br />    Loading composer repositories with package information<br />    Updating dependencies (including require-dev)<br />    Package operations: 104 installs, 0 updates, 0 removals<br />      - Installing cweagans/composer-patches (1.6.2): Downloading (100%)         <br />      - Installing drupal-composer/drupal-scaffold (2.3.0): Downloading (100%)         <br />      - Installing composer/installers (v1.4.0): Downloading (100%)         <br />      - Installing symfony/finder (v3.3.10): Downloading (100%)         <br />      - Installing symfony/yaml (v3.2.13): Downloading (100%)         <br />      - Installing drupal/console-extend-plugin (0.9.2): Downloading (100%)         <br />      - Installing paragonie/random_compat (v2.0.11): Downloading (100%)         <br />      - Installing symfony/polyfill-mbstring (v1.6.0): Downloading (100%)         <br />      - Installing symfony/http-foundation (v3.2.13): Downloading (100%)         <br />      - Installing psr/simple-cache (1.0.0): Downloading (100%)         <br />      - Installing psr/log (1.0.2): Downloading (100%)         <br />      - Installing psr/cache (1.0.1): Downloading (100%)         <br />      - Installing symfony/polyfill-apcu (v1.6.0): Downloading (100%)         <br />      - Installing symfony/cache (v3.3.10): Downloading (100%)         <br />      - Installing symfony/expression-language (v3.3.10): Downloading (100%)         <br />      - Installing symfony/dom-crawler (v3.3.10): Downloading (100%)         <br />      - Installing symfony/css-selector (v3.3.10): Downloading (100%)         <br />      - Installing jakub-onderka/php-console-color (0.1): Downloading (100%)         <br />      - Installing jakub-onderka/php-console-highlighter (v0.3.2): Downloading (100%)         <br />      - Installing dnoegel/php-xdg-base-dir (0.1): Downloading (100%)         <br />      - Installing nikic/php-parser (v3.1.1): Downloading (100%)         <br />      - Installing symfony/var-dumper (v3.3.10): Downloading (100%)         <br />      - Installing symfony/debug (v3.3.10): Downloading (100%)         <br />      - Installing symfony/console (v3.2.13): Downloading (100%)         <br />      - Installing psy/psysh (v0.8.13): Downloading (100%)         <br />      - Installing psr/http-message (1.0.1): Downloading (100%)         <br />      - Installing guzzlehttp/psr7 (1.4.2): Downloading (100%)         <br />      - Installing guzzlehttp/promises (v1.3.1): Downloading (100%)         <br />      - Installing guzzlehttp/guzzle (6.3.0): Downloading (100%)         <br />      - Installing gabordemooij/redbean (v4.3.4): Downloading (100%)         <br />      - Installing vlucas/phpdotenv (v2.4.0): Downloading (100%)         <br />      - Installing drupal/console-dotenv (0.3.0): Downloading (100%)         <br />      - Installing webmozart/assert (1.2.0): Downloading (100%)         <br />      - Installing webmozart/path-util (2.3.0): Downloading (100%)         <br />      - Installing webflo/drupal-finder (1.0.0): Downloading (100%)         <br />      - Installing twig/twig (v1.35.0): Downloading (100%)         <br />      - Installing symfony/translation (v3.2.13): Downloading (100%)         <br />      - Installing symfony/process (v3.2.13): Downloading (100%)         <br />      - Installing symfony/filesystem (v3.3.10): Downloading (100%)         <br />      - Installing symfony/event-dispatcher (v3.2.13): Downloading (100%)         <br />      - Installing symfony/dependency-injection (v3.2.13): Downloading (100%)         <br />      - Installing symfony/config (v3.2.13): Downloading (100%)         <br />      - Installing stecman/symfony-console-completion (0.7.0): Downloading (100%)         <br />      - Installing drupal/console-en (1.0.2): Downloading (100%)         <br />      - Installing dflydev/placeholder-resolver (v1.0.2): Downloading (100%)         <br />      - Installing dflydev/dot-access-data (v1.1.0): Downloading (100%)         <br />      - Installing dflydev/dot-access-configuration (v1.0.2): Downloading (100%)         <br />      - Installing drupal/console-core (1.0.2): Downloading (100%)         <br />      - Installing doctrine/collections (v1.5.0): Downloading (100%)         <br />      - Installing doctrine/lexer (v1.0.1): Downloading (100%)         <br />      - Installing doctrine/annotations (v1.5.0): Downloading (100%)         <br />      - Installing alchemy/zippy (0.4.3): Downloading (100%)         <br />      - Installing drupal/console (1.0.2): Downloading (100%)         <br />      - Installing zendframework/zend-stdlib (3.1.0): Downloading (100%)         <br />      - Installing zendframework/zend-escaper (2.5.2): Downloading (100%)         <br />      - Installing zendframework/zend-feed (2.8.0): Downloading (100%)         <br />      - Installing zendframework/zend-diactoros (1.6.1): Downloading (100%)         <br />      - Installing symfony/validator (v3.2.13): Downloading (100%)         <br />      - Installing symfony/serializer (v3.2.13): Downloading (100%)         <br />      - Installing symfony/routing (v3.2.13): Downloading (100%)         <br />      - Installing symfony/psr-http-message-bridge (v1.0.0): Downloading (100%)         <br />      - Installing symfony/polyfill-iconv (v1.6.0): Downloading (100%)         <br />      - Installing symfony/http-kernel (v3.2.13): Downloading (100%)         <br />      - Installing symfony/class-loader (v3.2.13): Downloading (100%)         <br />      - Installing symfony-cmf/routing (1.4.1): Downloading (100%)         <br />      - Installing stack/builder (v1.0.4): Downloading (100%)         <br />      - Installing masterminds/html5 (2.3.0): Downloading (100%)         <br />      - Installing egulias/email-validator (1.2.14): Downloading (100%)         <br />      - Installing easyrdf/easyrdf (0.9.1): Downloading (100%)         <br />      - Installing doctrine/inflector (v1.2.0): Downloading (100%)         <br />      - Installing doctrine/cache (v1.7.1): Downloading (100%)         <br />      - Installing doctrine/common (v2.8.1): Downloading (100%)         <br />      - Installing composer/semver (1.4.2): Downloading (100%)         <br />      - Installing asm89/stack-cors (1.1.0): Downloading (100%)         <br />      - Installing drupal/core (8.4.0): Downloading (100%)         <br />      - Installing phpdocumentor/reflection-docblock (2.0.5): Downloading (100%)         <br />      - Installing pear/console_table (v1.3.0): Downloading (100%)         <br />      - Installing consolidation/output-formatters (3.1.12): Downloading (100%)         <br />      - Installing consolidation/annotated-command (2.8.1): Downloading (100%)         <br />      - Installing drush/drush (8.1.15): Downloading (100%)         <br />      - Installing symfony/browser-kit (v3.3.10): Downloading (100%)         <br />      - Installing fabpot/goutte (v3.2.1): Loading from cache<br />      - Installing behat/mink (v1.7.1): Downloading (100%)         <br />      - Installing behat/mink-browserkit-driver (v1.3.2): Loading from cache<br />      - Installing behat/mink-goutte-driver (v1.2.1): Loading from cache<br />      - Installing jcalderonzumba/gastonjs (v1.0.3): Downloading (100%)         <br />      - Installing jcalderonzumba/mink-phantomjs-driver (v0.3.3): Downloading (100%)         <br />      - Installing mikey179/vfsstream (v1.6.5): Loading from cache<br />      - Installing sebastian/version (1.0.6): Loading from cache<br />      - Installing sebastian/global-state (1.1.1): Loading from cache<br />      - Installing sebastian/recursion-context (1.0.5): Loading from cache<br />      - Installing sebastian/exporter (1.2.2): Loading from cache<br />      - Installing sebastian/environment (1.3.8): Loading from cache<br />      - Installing sebastian/diff (1.4.3): Downloading (100%)         <br />      - Installing sebastian/comparator (1.2.4): Loading from cache<br />      - Installing doctrine/instantiator (1.1.0): Downloading (100%)         <br />      - Installing phpunit/php-text-template (1.2.1): Loading from cache<br />      - Installing phpunit/phpunit-mock-objects (2.3.8): Loading from cache<br />      - Installing phpunit/php-timer (1.0.9): Loading from cache<br />      - Installing phpunit/php-file-iterator (1.4.2): Loading from cache<br />      - Installing phpunit/php-token-stream (1.4.11): Loading from cache<br />      - Installing phpunit/php-code-coverage (2.2.4): Loading from cache<br />      - Installing phpspec/prophecy (v1.7.2): Downloading (100%)         <br />      - Installing phpunit/phpunit (4.8.36): Loading from cache<br />    paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)<br />    symfony/var-dumper suggests installing ext-symfony_debug ()<br />    psy/psysh suggests installing ext-pdo-sqlite (The doc command requires SQLite to work.)<br />    psy/psysh suggests installing hoa/console (A pure PHP readline implementation. You&#39;ll want this if your PHP install doesn&#39;t already support readline or libedit.)<br />    symfony/dependency-injection suggests installing symfony/proxy-manager-bridge (Generate service proxies to lazy load them)<br />    alchemy/zippy suggests installing guzzle/guzzle (To use the GuzzleTeleporter with Guzzle 3)<br />    zendframework/zend-feed suggests installing zendframework/zend-cache (Zend\Cache component, for optionally caching feeds between requests)<br />    zendframework/zend-feed suggests installing zendframework/zend-db (Zend\Db component, for use with PubSubHubbub)<br />    zendframework/zend-feed suggests installing zendframework/zend-http (Zend\Http for PubSubHubbub, and optionally for use with Zend\Feed\Reader)<br />    zendframework/zend-feed suggests installing zendframework/zend-servicemanager (Zend\ServiceManager component, for easily extending ExtensionManager implementations)<br />    zendframework/zend-feed suggests installing zendframework/zend-validator (Zend\Validator component, for validating email addresses used in Atom feeds and entries ehen using the Writer subcomponent)<br />    symfony/validator suggests installing symfony/intl ()<br />    symfony/serializer suggests installing symfony/property-access (For using the ObjectNormalizer.)<br />    symfony/serializer suggests installing symfony/property-info (To deserialize relations.)<br />    easyrdf/easyrdf suggests installing ml/json-ld (~1.0)<br />    doctrine/cache suggests installing alcaeus/mongo-php-adapter (Required to use legacy MongoDB driver)<br />    phpdocumentor/reflection-docblock suggests installing dflydev/markdown (~1.0)<br />    phpdocumentor/reflection-docblock suggests installing erusev/parsedown (~1.0)<br />    pear/console_table suggests installing pear/Console_Color2 (&gt;&#61;0.1.2)<br />    drush/drush suggests installing drush/config-extra (Provides configuration workflow commands, such as config-merge.)<br />    behat/mink suggests installing behat/mink-selenium2-driver (slow, but JS-enabled driver for any app (requires Selenium2))<br />    behat/mink suggests installing behat/mink-zombie-driver (fast and JS-enabled headless driver for any app (requires node.js))<br />    sebastian/global-state suggests installing ext-uopz (*)<br />    phpunit/php-code-coverage suggests installing ext-xdebug (&gt;&#61;2.2.1)<br />    phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)<br />    Writing lock file<br />    Generating autoload files<br />    Downloading (100%)Downloading (100%)Downloading (100%)Downloading (100%)Downloading (100%)Downloading (100%)Downloading (connecting.Downloading (100%)Downloading (100%)Downloading (100%)Downloading (100%)Downloading (100%)Downloading (100%)Downloading (connecting.Downloading (100%)Downloading (100%)Downloading (100%)Creating packages services cache file: <br />    /home/zbvabpx/cloudweb2/vendor/drupal/console/extend.console.uninstall.services.yml<br />    &gt; DrupalProject\composer\ScriptHandler::createRequiredFiles<br />    Create a sites/default/settings.php file with chmod 0666<br />    Create a sites/default/files directory with chmod 0777<br /><br /><br />De cette façon, le code Drupal est dans des sous-dossiers<br />et drush est installé.<br /><br />**J&#39;ajoute la commande qui me manquait :**<br /><br />    **~/composer.phar --profile install**<br /><br />    [8.6MB/0.07s] &gt; DrupalProject\composer\ScriptHandler::checkComposerVersion<br />    [8.9MB/0.08s] Loading composer repositories with package information<br />    [9.3MB/0.08s] Installing dependencies (including require-dev) from lock file<br />    [11.0MB/0.11s] Nothing to install or update<br />    [9.4MB/0.12s] Generating autoload files<br />    [9.9MB/0.23s] Removing packages services cache file:<br />    [9.9MB/0.23s] /home/zbvabpx/cloudweb2/vendor/drupal/console/extend.console.uninstall.services.yml<br />    [9.9MB/0.23s] Creating packages services cache file: <br />    [9.9MB/0.23s] /home/zbvabpx/cloudweb2/vendor/drupal/console/extend.console.uninstall.services.yml<br />    [9.9MB/0.25s] &gt; DrupalProject\composer\ScriptHandler::createRequiredFiles<br />    [10.1MB/0.25s] Memory usage: 10.07MB (peak: 11.58MB), time: 0.25s<br /><br /><br />Je dois modifier dans le manager OVH pour avoir la racine du site dans<br /><br />/cloudweb2/web  <br /><br />Le code Drupal est dans le sous-dossier /web<br /><br /><br />Ensuite je fais la config Drupal DB standard via le web.<br /><br />Puis je fais l&#39;installation d&#39;un module :<br /><br />et ça coince !<br /><br />    composer require drupal/pathauto<br /><br />    -bash: composer: command not found<br />    zbvabpx&#64;e82ecb26f949:~/cloudweb2$ ../composer require drupal/pathauto<br />    Using version ^1.0 for drupal/pathauto<br />    ./composer.json has been updated<br />    &gt; DrupalProject\composer\ScriptHandler::checkComposerVersion<br />    Loading composer repositories with package information<br />    Updating dependencies (including require-dev)<br />    Package operations: 3 installs, 0 updates, 0 removals<br />      - Installing drupal/token (1.0.0): Loading from cache<br /><br />    Installation failed, reverting ./composer.json to its original content.<br />    The following exception is caused by a **lack of memory or swap**, or not having swap configured<br />    Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details<br /><br />                                                         <br />      [ErrorException]                                   <br />      proc_open(): fork failed - **Cannot allocate memory**  <br />                                                     <br /><br />**... je ne comprend pas comment ce changement de config des dossiers, et l&#39;ajout de certains composants telque Drush, fait que Composer BOUFFE la mémoire comme cela !**<br /><br />bon, je vais essayer de m&#39;adapter à l&#39;autre structure de dossiers (celle que tu as utilisée), qui consomme nettement moins de ram.<br /><br />Merci. Didier

l'option d'installation C pour Drupal 8 "hussainweb/drupal-composer-init" ?

Oui, je vais la tester.
Je ne comprend pas la quantité de RAM bouffée par l'installation A.

Didier

Après avoir suivi la procédure d'installation de Drupal 8, option C "hussainweb/drupal-composer-init" :

https://www.drupal.org/node/2718229


~/cloudweb3$ ../composer install

Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 111 installs, 0 updates, 0 removals
- Installing cweagans/composer-patches (1.6.2): Loading from cache
No patches supplied.
Gathering patches for dependencies. This might take a minute.
- Installing drupal-composer/drupal-scaffold (2.3.0): Loading from cache
- Installing composer/installers (v1.4.0): Loading from cache
- Installing symfony/yaml (v3.2.13): Loading from cache
- Installing webmozart/assert (1.2.0): Loading from cache
- Installing webmozart/path-util (2.3.0): Loading from cache
- Installing symfony/filesystem (v3.3.10): Loading from cache
- Installing hussainweb/drupal-composer-helper (v1.0.0-beta3): Downloading (100%)
- Installing symfony/finder (v3.3.10): Loading from cache
- Installing drupal/console-extend-plugin (0.9.2): Loading from cache
- Installing zendframework/zend-stdlib (3.1.0): Loading from cache
- Installing zendframework/zend-escaper (2.5.2): Loading from cache
- Installing zendframework/zend-feed (2.8.0): Loading from cache
- Installing psr/http-message (1.0.1): Loading from cache
- Installing zendframework/zend-diactoros (1.6.1): Loading from cache
- Installing twig/twig (v1.35.0): Loading from cache
- Installing symfony/polyfill-mbstring (v1.6.0): Loading from cache
- Installing symfony/translation (v3.2.13): Loading from cache
- Installing symfony/validator (v3.2.13): Loading from cache
- Installing symfony/serializer (v3.2.13): Loading from cache
- Installing symfony/routing (v3.2.13): Loading from cache
- Installing paragonie/random_compat (v2.0.11): Loading from cache
- Installing symfony/http-foundation (v3.2.13): Loading from cache
- Installing symfony/psr-http-message-bridge (v1.0.0): Loading from cache
- Installing symfony/process (v3.2.13): Loading from cache
- Installing symfony/polyfill-iconv (v1.6.0): Loading from cache
- Installing symfony/event-dispatcher (v3.2.13): Loading from cache
- Installing psr/log (1.0.2): Loading from cache
- Installing symfony/debug (v3.3.10): Loading from cache
- Installing symfony/http-kernel (v3.2.13): Loading from cache
- Installing symfony/dependency-injection (v3.2.13): Loading from cache
- Installing symfony/console (v3.2.13): Loading from cache
- Installing symfony/class-loader (v3.2.13): Loading from cache
- Installing symfony-cmf/routing (1.4.1): Loading from cache
- Installing stack/builder (v1.0.4): Loading from cache
- Installing masterminds/html5 (2.3.0): Loading from cache
- Installing guzzlehttp/psr7 (1.4.2): Loading from cache
- Installing guzzlehttp/promises (v1.3.1): Loading from cache
- Installing guzzlehttp/guzzle (6.3.0): Loading from cache
- Installing doctrine/lexer (v1.0.1): Loading from cache
- Installing egulias/email-validator (1.2.14): Loading from cache
- Installing easyrdf/easyrdf (0.9.1): Loading from cache
- Installing doctrine/inflector (v1.2.0): Loading from cache
- Installing doctrine/collections (v1.5.0): Loading from cache
- Installing doctrine/cache (v1.7.1): Loading from cache
- Installing doctrine/annotations (v1.5.0): Loading from cache
- Installing doctrine/common (v2.8.1): Loading from cache
- Installing composer/semver (1.4.2): Loading from cache
- Installing asm89/stack-cors (1.1.0): Loading from cache
- Installing drupal/core (8.4.0): Loading from cache
The following exception is caused by a lack of memory or swap, or not having swap configured
Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details


[ErrorException]
proc_open(): fork failed - Cannot allocate memory

Marre de Composer !
Pourquoi ça bouffe autant de ram pour donwloader des fichiers source PHP ?

Merci. Didier

Si ça peut aider, J'ai réussi à ajouter des modules via composer en stoppant les services apache et mysql:

sudo systemctl stop apache2.service
sudo systemctl stop mysql.service

un peu radicale, mais j'ai pu donwloader mes modules qui me manquaient…

composer require drupal/robotstxt
composer require drupal/backup_migrate

puis redémarrage des services:

sudo systemctl start apache2.service
sudo systemctl start mysql.service

Bonne astuce, merci. Mais effectivement on se demande pourquoi Composer a besoin d'autant de mémoire. Il cache les fichiers ou quoi? Si oui, pour un téléchargement one shot on voit pas bien à quoi ça sert.

oui, intéressant pour un VPS par exemple.
Mais avec OVH Cloud Web, on n'a pas la possibilité de faire un "stop apache" …
:wink:


Mais effectivement on se demande pourquoi Composer a besoin d'autant de mémoire. Il cache les fichiers ou quoi?


C'est une très bonne question !
Je me demande aussi pourquoi Composer à besoin de tant de mémoire.
Composer avec drupal "tout seul" ça semble aller...
mais si tu installes un projet plus complet, du genre :

`composer create-project drupal-composer/drupal-project:8.x-dev my_site_name_dir --stability dev --no-interaction`

alors, là, ça bouffe de la RAM ...

Bonjour,

je viens de lire vos posts parce que je bute sur le même problème en essayant d'installer "opigno-composer". Je suis effectivement passé en hébergement Pro pour avoir le ssh parce que je n'arrive pas à obtenir une installation correcte en sftp avec FileZilla comme je l'ai toujours fait.

J'espère que, depuis le mois de mars, vous avez trouvé une solution et, dans ce cas, pourriez-vous m'aider à ce propos ?

Amicalement,

Olivier

quelle commande pose souci?

dans un autre sujet, c'est expliqué, ajoute un truc du genre
```text
php -d memory_limit=1G composer …
```
à extrapoler, moi j'utilise ça pour un autre packager