沃梦达 / 编程问答 / php问题 / 正文

PHP Composer 更新“无法分配内存"错误(使用 Laravel 4)

PHP Composer update quot;cannot allocate memoryquot; error (using Laravel 4)(PHP Composer 更新“无法分配内存错误(使用 Laravel 4))

本文介绍了PHP Composer 更新“无法分配内存"错误(使用 Laravel 4)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我就是解决不了这个问题.

I just can't solve this one.

我正在使用 Linode 1G RAM 基本计划.试图通过 Composer 安装一个包,它不让我.我的内存限制在 PHP.ini 上设置为-1"

I'm on Linode 1G RAM basic plan. Trying to install a package via Composer and it's not letting me. My memory limit is set to "-1" on PHP.ini

我还能做些什么来安装它吗?

Is there anything else I can do to get this installed?

Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing thujohn/rss (dev-master df80a7d)
    Downloading: 100%         
PHP Fatal error:  Uncaught exception 'ErrorException' with message 'proc_open(): fork failed - Cannot allocate memory' in phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:975
Stack trace:
#0 [internal function]: ComposerUtilErrorHandler::handle(2, 'proc_open(): fo...', 'phar:///usr/loc...', 975, Array)
#1 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(975): proc_open('stty -a | grep ...', Array, NULL, NULL, NULL, Array)
#2 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(853): SymfonyComponentConsoleApplication->getSttyColumns()
#3 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(818): SymfonyComponentConsoleApplication->getTerminalDimensions()
#4 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(752): SymfonyComponentConsoleApplication->getTerminalWidth()
#5 phar:///usr/local/bin/com in phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php on line 975

Fatal error: Uncaught exception 'ErrorException' with message 'proc_open(): fork failed - Cannot allocate memory' in phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:975
Stack trace:
#0 [internal function]: ComposerUtilErrorHandler::handle(2, 'proc_open(): fo...', 'phar:///usr/loc...', 975, Array)
#1 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(975): proc_open('stty -a | grep ...', Array, NULL, NULL, NULL, Array)
#2 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(853): SymfonyComponentConsoleApplication->getSttyColumns()
#3 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(818): SymfonyComponentConsoleApplication->getTerminalDimensions()
#4 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(752): SymfonyComponentConsoleApplication->getTerminalWidth()
#5 phar:///usr/local/bin/com in phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php on line 975

推荐答案

有点老了,但以防万一新人正在寻找解决方案,更新您的 PHP 版本可以解决问题.

A bit old but just in case someone new is looking for a solution, updating your PHP version can fix the issue.

您还应该提交您的 composer.lock 文件并在资源密集型较少的生产环境中安装 composer.

Also you should be committing your composer.lock file and doing a composer install on a production environment which is less resource intensive.

更多细节在这里:https://github.com/composer/composer/issues/1898#issuecomment-23453850

这篇关于PHP Composer 更新“无法分配内存"错误(使用 Laravel 4)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:PHP Composer 更新“无法分配内存"错误(使用 Laravel 4)

基础教程推荐