Home > Backend Development > PHP Tutorial > How to Fix 'Allowed memory size of 1610612736 bytes exhausted' Error in Composer Require?

How to Fix 'Allowed memory size of 1610612736 bytes exhausted' Error in Composer Require?

Barbara Streisand
Release: 2024-12-09 04:15:15
Original
688 people have browsed it

How to Fix

Composer Require Fails with Memory Exhaustion Error: "Allowed memory size of 1610612736 bytes exhausted"

To resolve the memory exhaustion error encountered while running "composer require hwi/oauth-bundle", investigate the following solutions:

  1. Increase the PHP Memory Limit:

    • Check the current memory limit using "php -r "echo ini_get('memory_limit').PHP_EOL;"".
    • Modify the "memory_limit" value in "/etc/php5/cli/php.ini" (for Debian-like systems) to "-1" for unlimited memory or set an explicit value such as "2G".
  2. Override Memory Limit with Command-Line Argument:

    • Include "-d memory_limit=-1" in the composer command: "php -d memory_limit=-1 composer.phar require hwi/oauth-bundle php-http/guzzle6-adapter php-http/httplug-bundle".
  3. Check PHP.ini Location:

    • Execute "php --ini" to determine the locations of loaded php.ini files.
  4. Temporary Solution:

    • Use the "COMPOSER_MEMORY_LIMIT=-1 composer require hwi/oauth-bundle php-http/guzzle6-adapter php-http/httplug-bundle" command.
  5. Simplified Solution:

    • Run "COMPOSER_MEMORY_LIMIT=-1 composer require hwi/oauth-bundle php-http/guzzle6-adapter php-http/httplug-bundle" to override the memory limit.

The above is the detailed content of How to Fix 'Allowed memory size of 1610612736 bytes exhausted' Error in Composer Require?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template