異常背景
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