Composer: Memory Limit Error on Shared Hosting
Memory.
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.
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

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

Use composer install --no-dev on live sites, so development tools are not installed.
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

Run Composer on your own computer and upload the vendor folder. Compare the PHP version first.
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

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
- Writing Clear Error Reports: Screenshots, URLs and Steps
- WordPress Tag and Date Archives Duplicate Content: Settings
- WordPress Permalinks Change: Redirect Old URLs and Avoid 404s
- Error Establishing a Database Connection in WordPress: Full Checklist