LoginSignup
18
20

More than 5 years have passed since last update.

composer updateがPHPのメモリ制限に引っかかってできない時

Posted at

新規にプロジェクトを設置してcomposer updateしたら以下のエラーがでて行えなかった。

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

対処方法

php.iniの設定を変える

1.php.ini開く
vim /etc/php.ini

2.php.ini内で検索
/memory_limit

memory_limit = 128M

3.適宜変更
memory_limit = 1024M

4.apacheリスタート
/etc/init.d/httpd restart
composer update時に指定する

実行時のオプションで頑張る

php -d memory_limit=768M /usr/local/src/composer.phar update

基本的にphp.iniを設定すると他のプログラムにも影響があるから、実行時のオプションで頑張ったほうがよい。

18
20
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
20