&tag(IntelliJ/PHP);
*目次 [#rac604fe]
#contents
*関連ページ [#n8b398a4]
*参考情報 [#v4feb40f]


*Xdebugでデバッグする方法 [#bc81fa4f]

**前提 [#p48ba243]
-サーバーはCentOS 6.3 / PHP 5.3
-クライアント(IntelliJ側)は、Windows 7。

*サーバーの設定 [#a59f6903]
**サーバーの設定 [#a59f6903]
-remiやepelリポジトリを有効にして、yum install php-pecl-xdebugでパッケージを入れる方法もあるが、Xdebug 2.1.xにはページがブランクになるバグが存在する。[[0000810: 2.2.0RC1-5.4-vc9.dll will not start debug session on php 5.4.0 ts - MantisBT:http://bugs.xdebug.org/view.php?id=810]]
-より新しいバージョンをインストールするために、yum install php-peclしておき、pecl経由でxdebugをインストールしないといけない。
 # pecl install xdebug
-peclでインストールした場合、/etc/php.iniの一番下に以下を追加する。
#pre{{
; Enable xdebug extension module
zend_extension=/usr/lib64/php/modules/xdebug.so
xdebug.default_enable=1
xdebug.idekey = "PHPSTORM"
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.remote_connect_back=1
xdebug.remote_autostart=1
xdebug.profiler_enable=1
xdebug.remote_log="/tmp/xdebug.log"
xdebug.remote_handler=dbgp

}}

**IntelliJ側の設定 [#w34c0372]
-PHPインタプリタの設定は不用。
-Debug Configurationで、PHP Remote Debugを追加。サーバー設定で
--名前: 適当
--ホスト: 上記CentOSマシンのホスト名、
--Port: 80
--Debugger: Xdebug
--Use path mappingにチェック。対応するサーバー上のソースパイルのパスを絶対パスで指定する。

**デバッグの実行 [#c39bc7d5]
-PHP Remote DebugのConfigurationをツールバーで選んで、その横にある電話アイコン的なやつを有効にする。
-あとはブレークポイントを設定したページを読みこめばとまる。
-公式で準備されているブックマークレット等は別になくてもOKだった。


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS