XdebugをLinux(CentOS6)に入れる。初期設定とかはまったとことか
ソースから入れる方法です。
// 最新のバージョンをダウンロード # wget http://www.xdebug.org/files/xdebug-2.3.3.tgz # tar xzvf xdebug-2.3.3.tgz # cd xdebug-2.3.3/ # phpize # ./configure --enable-xdebug # make # make install
phpizeで以下のようなエラーが発生する場合
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "ja_JP.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "ja_JP.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
環境変数を指定あげるとうまくいきます。
# echo ”export LC_ALL=C” >> /root/.bashrc # source /root/.bashrc
make installが成功すると以下のようなxdebug.soのパスが表示されます。
Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20131226/
このパスを元にphp.iniを編集します。
phpinfoを使ってLoaded Configuration Fileに指定されているphp.iniのパスを確認します。
もし指定されていなければその上のConfiguration File (php.ini) Pathのパスのディレクトリ以下にphp.iniファイルを作成します。
php.iniに以下を追記します。
;xdebug zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so xdebug.default_enable=1 xdebug.remote_enable=on xdebug.remote_port=9000 xdebug.remote_handler=dbgp xdebug.remote_autostart=1 xdebug.remote_host=localhost xdebug.var_display_max_children = -1 xdebug.var_display_max_data = -1 xdebug.var_display_max_depth = -1
サーバー再起動
# /etc/init.d/httpd restart
phpinfo内にxdebugで検索して何か入っていたらだいたい成功です。
ブラウザ上でxdebugのオレンジ色のテーブルのエラーが表示されない場合、html_errorsがOffになっているかもしれません。
# vi php.ini html_errors = Off ↓ html_errors = On