“Uncaught exception ‘ErrorException’ with message ‘proc_open(): fork failed” with composer

I got this error while updating with composer:

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:943

logo-composer-transparent

I though it was just the same error I had before that I fixed giving unlimit memory to the PHP process, but it wasn’t the same and didn’t work. The only way I could fix it was updating from PHP 5.3.10 to PHP 5.5.16 (PHP 5.4 should work too).

First of all make a backup of the Apache and PHP configuration files:

/etc/apache2/apache2.conf
/etc/php5/apache2/php.ini
/etc/php5/cli/php.ini

Add the repository you need:

  • PHP 5.4: sudo add-apt-repository ppa:ondrej/php5-oldstable
  • PHP 5.5: sudo add-apt-repository ppa:ondrej/php5

And update/upgrade:

sudo apt-get update
sudo apt-get upgrade

You’ll probably get a message like this:

The following packages have been kept back:
  apache2 apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common
  libapache2-mod-php5 libapr1 libapr1-dev libaprutil1 libaprutil1-dbd-sqlite3
  libaprutil1-dev libaprutil1-ldap libjson0 libjson0:i386 php-pear php5
  php5-cli php5-common php5-curl php5-dev php5-gd php5-imagick php5-intl
  php5-mcrypt php5-mysqlnd php5-pgsql php5-xdebug php5-xmlrpc php5-xsl
0 upgraded, 0 newly installed, 0 to remove and 29 not upgraded.

You can update those packages by hand:

sudo apt-get -y install php-pear php5 php5-cli php5-common php5-curl php5-dev php5-gd php5-imagick php5-intl php5-mcrypt php5-mysqlnd php5-pgsql php5-xdebug php5-xmlrpc php5-xsl

Then remove the unnecesary ones:

sudo apt-get autoremove

And update the rest:

sudo apt-get -y install apache2 apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common libapache2-mod-php5

During the update process you’ll be asked what to do with your original Apache and PHP configuration files. I like letting the update process to update them so I can compare with my backups later and fix anything that’s missing. For example the xdebug.so library in PHP 5.3 was in /usr/lib/php5/20090626/xdebug.so and in PHP 5.5 it’s in /usr/lib/php5/20121212/xdebug.so.

UPDATE: Apache 2.4 uses IncludeOptional instead of Include and it made my virtual host stop working. I changed back to Include and the everything was fine.

Include sites-enabled/*.conf

Ref: https://github.com/composer/composer/issues/945
http://www.pixelite.co.nz/article/upgrading-php-54-ubuntu-1204-lts-support-drupal-8

You might also like

Fix “Fatal error: Allowed memory size of X bytes exhausted (tried to allocate X bytes)” with composer update
I got this error today when running composer update for one of my Symfony2 projects:Fatal error:...

Install a Symfony2 application using Composer
Before installing any Symfony2 project you have to meet the minimum requirements for it in your server....

Fix “Class ‘PMA_Message’ not found” in phpMyAdmin with nginx + PHP_FPM
After updating phpMyAdmin I got this error:PHP message: PHP Fatal error: Class 'PMA_Message' not...

Symfony2 – ErrorException: Notice: serialize() [function.serialize]: “xxx” returned as member variable from __sleep() but does not exist in …
While storing an entity from Doctrine2 in the session under a Symfony2 application I got this error:ErrorException:...

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.