I’ve upgraded a website from Drupal 7 to Drupal 8
I did the configuration locally using ddev, using composer to install modules etc.
The site is now uploaded to our shared web host, which has a limit of 2 GB RAM.
I’m running into errors when I try and use composer to install new modules or perform upgrades
Composer require drupal/entity_delete
Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 4096 bytes) in phar:///opt/cpanel/composer/bin/composer/src/Composer/DependencyResolver/Solver.php on line 223
Our database is only 40 MB and file system is 400 MB and entity_delete is 32 KB so I’m trying to understand why Drupal needs over 2 GB of RAM and if there is a way to resolve this?
(without having to perform all the updates locally each time.)
Mark
2
Answers
You need to increase the memory_limit to avoid this
Try
COMPOSER_MEMORY_LIMIT=-1 composer require drupal/entity_delete
for a one shot run with no memory limitSee https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more explanations.
Drupal is fine, it is Composer — If you can avoid doing
composer require
orcomposer update
on the host and instead do that in a development environment; that would be the way to go. Then you take the updated composer.lock and simply runcomposer install
on your host and that would be much less memory intensive.Otherwise; I had a similar issue and ended up enabling swap memory so that I could do that on a host that only has 512MB of memory (Runs Drupal 9 fine).
How to do that would depend on your host operating system but look up on how to do that if you wish.