PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Solver.php on line 223

异常背景

Laravel 安装 tymon/jwt-auth包时,

vagrant@homestead:~/share/el$ composer require tymon/jwt-auth

抛出异常错误:

PHP Fatal error:  Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Solver.php on line 223

查阅资料有两种解决方案:
1、去php的配置文件php.ini中找到memory_limit配置,把配置改为memory_limit=-1,重启php服务器
2、命令运行脚本:

composer -h 查看composer的路径

vagrant@homestead:~/share/el$ compser -h
Help:
  The help command displays help for a given command:
  
    php /usr/local/bin/composer help list
  
  You can also output the help in other formats by using the --format option:
  
    php /usr/local/bin/composer help --format=xml list
  
  To display the list of available commands, please use the list command.

运行脚本 php -d memory_limit=-1 /usr/local/bin/composer require tymon/jwt-auth

vagrant@homestead:~/share/el$php -d memory_limit=-1 /usr/local/bin/composer require tymon/jwt-auth
posted @ 2020-10-19 17:16  phper-liunian  阅读(668)  评论(0编辑  收藏  举报