LoginSignup
15
17

More than 5 years have passed since last update.

CentOS5でxdebugを使う

Last updated at Posted at 2013-09-03

今回試したのはCentOS 5.2 64bit版。

xdebugソースのダウンロード

  1. http://xdebug.org/files/ から http://xdebug.org/files/xdebug-2.2.7.tgz をダウンロード
  • xdebug 2.5 : php5.5以降
  • xdebug 2.4 : php5.4以降
  • xdebug 2.3.3 : php5.2対応の最終版?しかしmakeが成功しなかった。
  • xdebug 2.2.7 : makeが成功した。
  1. 解凍
configureファイルを作成
phpize
./configure \
 --prefix="/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"
make
ls -lh modules/*.so
  • ./modules/xdebug.so ができる。

設定

  1. xdebug.so を好きな場所に配置。(例: /opt/xdebug.so)
  2. /etc/php.d/xdebug.ini に以下記載
/etc/php.d/xdebug.ini
zend_extension="/opt/xdebug.so"
xdebug.remote_enable= on
xdebug.remote_handler=dbgp
;xdebug.remote_host=localhost
xdebug.remote_host=192.168.100.51
xdebug.remote_port=9000
xdebug.remote_autostart = on
xdebug.remote_mode=req
xdebug.dump.GET = *
xdebug.dump.POST = *
  • remote_host で指定するIPは、デバッグ情報を利用したい端末のIPを指定。

反映

$ sudo servce httpd restart

確認

  1. phpinfoでxdebugの項目があることを確認。
  2. IDE側でブレイクポイント設置し待受け開始
  3. WEBページにアクセスするとブレイクポイントで止まる。

netbeansを動かしてみる

  • jreをインストールしておく。
sudo yum install -y \
  xrdp xterm fonts-japanese
sudo sh netbeans-8.0.2-php-linux.sh
/usr/local/netbeans-8.0.2/bin/netbeans
  • デバッグ > ファイルをデバッグ
    • F8: ステップアウト
    • F7: ステップイン
15
17
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
15
17