PHP solves the problem that composer exceeds the memory size Allowed memory size


Today, when I used composer to update and install the expansion pack, it reported that the memory size was exceeded

Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/DependencyResolver/Rule2Literals.php on li
ne 53

Check for more info on how to handle out of memory errors.


First execute the composer help command to obtain the composer installation directory

composer -h

Results of the

D:\php_work\fund-admin>composer -h
  help [options] [--] [<command_name>]

  command                        The command to execute
  command_name                   The command name [default: "help"]

      --xml                      To output help as XML
      --format=FORMAT            The output format (txt, xml, json, or md) [default: "txt"]
      --raw                      To output raw command help
  -h, --help                     Display this help message
  -q, --quiet                    Do not output any message
  -V, --version                  Display this application version
      --ansi                     Force ANSI output
      --no-ansi                  Disable ANSI output
  -n, --no-interaction           Do not ask any interactive question
      --profile                  Display timing and memory usage information
      --no-plugins               Whether to disable plugins.
  -d, --working-dir=WORKING-DIR  If specified, use the given directory as working directory.
      --no-cache                 Prevent use of the cache
  -v|vv|vvv, --verbose           Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

  The help command displays help for a given command:

    php C:\ProgramData\ComposerSetup\bin\composer.phar help list

  You can also output the help in other formats by using the --format option:

    php C:\ProgramData\ComposerSetup\bin\composer.phar help --format=xml list

  To display the list of available commands, please use the list command.

I can seeĀ C:\ProgramData\ComposerSetup\bin\composer.pharmy composer installation directory

At this time, the installation extension command is modified to

# php -d memory_limit=-1 php program set memory unlimited
# C:\ProgramData\ComposerSetup\bin\composer.phar composer install url
# require dcat/laravel-admin:"2.*" -vvv Loading expansion packs
php -d memory_limit=-1 C:\ProgramData\ComposerSetup\bin\composer.phar require dcat/laravel-admin:"2.*" -vvv

Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *