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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM