Is 1GB RAM enough for installing composer and laravel?

Debian 9 (1 GB RAM, 25 GB storage) Apache MariaDB PHP 7.2

Composer and Laravel installed successfully

Then, attempted to add a package with composer … ran following line in Putty composer require mobiledetect/mobiledetectlib

returned the following…

Using version ^2.8 for mobiledetect/mobiledetectlib ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev)

mmap() failed: [12] Cannot allocate memory

mmap() failed: [12] Cannot allocate memory PHP Fatal error: Out of memory (allocated 878714880) (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Solver.php on line 223

Fatal error: Out of memory (allocated 878714880) (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Solver.php on line 223

Checked for the mobiledetect folder in /var/www/domainname/html/projectname/vendor but no folder there

Currently have 1 GB RAM in DigitalOcean, do I need to up it to 2 GB RAM for composer to run updates properly?

I ran the command … php -r “echo ini_get(‘memory_limit’).PHP_EOL;” and -1 was returned which means unlimited

I checked the php.ini file and found… ; Maximum amount of memory a script may consume (128MB) ; memory_limit = -1

I used the ‘top’ command to view that only 1 % of CPU is in use

and free -m returns total used free shared buff/cache available Mem: 996 134 800 21 60 750

I read that composer increases internal memory to 1.5 GB here

Any suggestions would be appreciated.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

The OS you’re using plays an integral role in memory management, one of the easy hacks to eliminate these memory errors is to add Swap memory file and SSD storage also helps in faster swaps. Refer to the tutorial below:

Site Moderator
Site Moderator badge
August 4, 2022

Hello @anjanesh

If you’re expecting moderate to high traffic for the site, then I’m afraid 512MB RAM will not be enough the handle the requests. However, if this is a side project then it does not require a lot of resources for now it’s a good starting point.

I’ll also recommend adding SWAP space on your droplet, which will significantly improve its performance.

Laravel is also available as a one-click installation app through our marketplace portal. You can find the application here:

We also have a pretty neat tutorial on How To Install and Configure Laravel with Nginx find the link for the article below:


Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel