HomeComputer programmingAmazon EC2: Fix for Error When Using Composer.phar

Amazon EC2: Fix for Error When Using Composer.phar

When using The Composer dependency manager for PHP, people will occasionally experience errors when using Amazon’s EC2 service. A simple fix exists for this issue.

Recently, when trying to install Symfony2 on an EC2 instance, I found the following error:

“Uncaught exception ‘ErrorException’ with message ‘proc_open(): fork failed – Cannot allocate memory’ in phar…”

In debugging this issue, I found that a lot of people were experiencing this same issue. Typically this occurs when using Composer.phar on a t1.micro instance. The small memory footprint of this instance does not have enough swap memory for Composer.phar to execute correctly.

 

Increase Instance Size

To correct this issue, just temporarily change your instance to a larger instance. You can do this by stopping the instance and then selecting Change Instance Type from the Actions menu. You may have to adjust your IP address and security depending on configuration.

changing the ec2 instance type

After you have increased your instance capabilities, use composer.phar to install your PHP data. After you have finished, then feel free to stop the instance and downgrade again if you wish to save money. Once again you may have to change your IP address and security settings.

 

Increase PHP Limits

Alternatively, you can increase your PHP memory_limit to at least 256M. Often this will give PHP enough free memory to run composer without the errors.

David Kirk
David Kirk
David Kirk is one of the original founders of tech-recipes and is currently serving as editor-in-chief. Not only has he been crafting tutorials for over ten years, but in his other life he also enjoys taking care of critically ill patients as an ICU physician.
RELATED ARTICLES
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
- Advertisment -

Most Popular

Recent Comments

Cleveland Furia on How to Clear Google Activity
Sid Wohlfarth on How to Clear Google Activity
Riley Magsayo on How to Clear Google Activity
สมัครรับเครดิตฟรี ทันที on How to improve Remote Desktop Protocol Performance
Neal Wangstad on How to Clear Google Activity
Slavcho Andov on How to install Ubuntu
Slavcho Andov on How to fix bad sectors
Sheraz Ali on How to Backup Android
0
Would love your thoughts, please comment.x
()
x