Guides › HTML / PHP sites › Site down or error screens

Composer: Memory Limit Error on Shared Hosting

Memory.

Reference guide. This guide is written from established practice and the official documentation of the tools involved. We have not yet tested every step on a live demo site. Back up your site before you change anything.
Site down or error page

Composer errors such as Allowed memory size exhausted happen because shared hosting limits PHP memory. You can raise it for one run without touching server settings.

1Read the error2Run with no limit3Install fewer packages4Use the lock file5Build locally6Add swap or ask the host7Test the siteFixed? Test the site. If not, get help.
The steps in order. Work down the list and stop when the problem is solved.

Step 1: Read the error

Illustration for Step 1: Read the error

It names the amount, for example Allowed memory size of 134217728 bytes exhausted. That is the limit being hit.

Step 2: Run with no limit

Illustration for Step 2: Run with no limit

From the project folder, run COMPOSER_MEMORY_LIMIT=-1 composer install. Or php -d memory_limit=-1 composer.phar install if you use the phar.

Step 3: Install fewer packages

Illustration for Step 3: Install fewer packages

Use composer install --no-dev on live sites, so development tools are not installed.

Step 4: Use the lock file

Illustration for Step 4: Use the lock file

Run composer install, not update. Update needs much more memory. Upload an existing composer.lock from your computer.

Step 5: Build locally

Illustration for Step 5: Build locally

Run Composer on your own computer and upload the vendor folder. Compare the PHP version first.

Step 6: Add swap or ask the host

Illustration for Step 6: Add swap or ask the host

If you have your own server, add swap space. On shared hosting ask support to raise the limit.

Step 7: Test the site

Illustration for Step 7: Test the site

Open the site and check for errors after the install.

Still stuck?

If these steps do not solve it, we fix it for you for a flat $99. Full refund if we do not solve it within 7 days.

Related guides

Did this solve it? If not, email hello@sitefixlab.org with the exact error text and we will look into it. Try the problem finder.

Last updated 2026-11-22.