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.

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

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!