dsgs8208 2019-07-18 08:32
浏览 1003
已采纳

Composer内存不足 - 需要替代方法来增加PHP memory_limit

I'm trying to install an extension on a client's Magento 2 via Composer, but I'm running into the old PHP out of memory error.

My client is hosted with Bluehost, which unfortunately means I can't just go in and change the memory_limit in php.ini, as it's read only, and their cPanel MultiPHP INI Editor doesn't affect SSH. My client has been in touch with Bluehost, and they were told Bluehost doesn't allow SSH memory_limit to be altered, HOWEVER, my client only recently had to install a different extension, which required the memory_limit to be increased, but they did it themselves and they can't remember what commands they used or the file they edited.

I can confirm Composer is installed properly on the server, since I can run the command composer require path/to/extension. This just results in the out of memory error.

Running the command COMPOSER_MEMORY_LIMIT=-1 composer require amasty/advanced-review results in the same error:

mmap() failed: [12] Cannot allocate memory

mmap() failed: [12] Cannot allocate memory

Fatal error: Out of memory (allocated 809508864) (tried to allocate 4096
bytes) in phar:///opt/cpanel/composer/bin/composer/src/Composer
/DependencyResolver/RuleSetGenerator.php on line 126

Anyone have any suggestions as to what I can do to get things working properly?

  • 写回答

1条回答 默认 最新

  • douyi1779 2019-07-18 08:58
    关注

    You aren't running into the PHP memory limit. If that where the case the error message would be something like "Allowed memory size of N bytes exhausted". The failing mmap call suggests that you are running out of physical memory.

    Either upgrade the host or do the dependency updates on another machine with more memory. To do so

    1. Copy composer.json and composer.lock to a machine with sufficient memory
    2. Run composer require amasty/advanced-review --no-scripts --ignore-platform-reqs on that machine
    3. Copy the updated composer.json and composer.lock files back to the Bluehost machine
    4. Run composer install on the Bluehost machine

    This works because composer install doesn't do any complex dependency resolution and thus requires little memory.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog