LoginSignup
8
7

More than 5 years have passed since last update.

php composer.phar update でエラーが出て実行できない

Last updated at Posted at 2014-07-04

FuelPHPでローカルで開発していたものを本番に設置したら、

Composer is not installed. Please run "php composer.phar update" in the root to install Composer

と出たので、言われた通りに実行したけど、なんかエラーが出る

hoge@server:~$ php composer.phar update
????hoge@server~$ 

????ってなんぞ。。
export LANG=en_USとかもしてみたけど変化なく????。
はまったので公式を見た。

Composer - Troubleshooting
https://getcomposer.org/doc/articles/troubleshooting.md

ここにcurl -sS https://getcomposer.org/installer | php -- --checkというコマンドで動作環境のチェックができるようなので実行した。

hoge@server:~$ curl -sS https://getcomposer.org/installer | php -- --check
#!/usr/bin/env php
Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:

The detect_unicode setting must be disabled.
Add the following to the end of your `php.ini`:
    detect_unicode = Off

The php.ini used by your command-line PHP is: /path/to/php.ini
If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.

detect_unicode = Offの設定にしてないといけないみたい。
php.iniにdetect_unicode = Offを追加する事でうまく動くようになりました。

PHP5.5の開発環境だと特に設定した事ないからPHP5.3だとやらないといけないのかな。

php.iniを触らなくてもこんな感じでも大丈夫でした

php -d detect_unicode=Off composer.phar self-update
php -d detect_unicode=Off composer.phar update

ところでdetect_unicode = Offって何だろう。
公式にはこんな感じで書かれてた。将来廃止予定とか。

detect_unicode boolean
BOM (Byte Order Mark) を調べ、 ファイルが有効なマルチバイト文字を含むかどうかを確認します。 この検出は、 __halt_compiler() の処理より前に行われます。 Zend Multibyte モードでのみ利用可能です。

名前 : detect_unicode
デフォルト : "1"
変更可能 : PHP_INI_ALL
変更履歴 : PHP 5.1.0 以降で利用可能。この非推奨の機能は、きっと 将来 削除 されるでしょう。
8
7
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
8
7