将 Symfony2 项目部署到服务器时,我偶尔会收到以下错误:
PHP Fatal error: Uncaught exception 'ErrorException' with message 'proc_open():
fork failed - Cannot allocate memory' in
in phar:///var/www/xyz.co.uk/releases/20130320161122/composer.phar/vendor/
symfony/console/Symfony/Component/Console/Application.php:982
更新
完整的错误消息如下--> Updating Composer dependencies
:
*** [err :: x.xx.xx.xxx] PHP Fatal error: Uncaught exception 'ErrorException' with message 'proc_open(): fork failed - Cannot allocate memory' in phar:///var/www/xyz.co.uk/releases/20130320161815/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:982
*** [err :: x.xx.xx.xxx] Stack trace:
*** [err :: x.xx.xx.xxx] #0 [internal function]: Composer\Util\ErrorHandler::handle(2, 'proc_open(): fo...', 'phar:///var/www...', 982, Array)
*** [err :: x.xx.xx.xxx] #1 phar:///var/www/xyz.co.uk/releases/20130320161815/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php(982): proc_open('stty -a | grep ...', Array, NULL, NULL, NULL, Array)
*** [err :: x.xx.xx.xxx] #2 phar:///var/www/xyz.co.uk/releases/20130320161815/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php(900): Symfony\Component\Console\Application->getSttyColumns()
*** [err :: x.xx.xx.xxx] #3 phar:///var/www/xyz.co.uk/releases/20130320161815/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php(865): Symfony\Component\Console\ in phar:///var/www/xyz.co.uk/releases/20130320161815/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php on line 982
*** [deploy:update_code] rolling back
failed: "sh -c 'sh -c '\\''cd /var/www/xyz.co.uk/releases/20130320161815 && php composer.phar update --no-scripts --verbose --prefer-dist'\\'''" on x.xx.xx.xxx
这不会一直发生,但有时会发生。我在服务器上的 apache 和 cli php.ini 文件中分配了 256M,但有时仍会收到错误消息。
Symfony 需要多少内存?我需要进一步增加吗?我以为这就够了。