WindowsでPhpStormとXdebugを動かす
少しハマったので整理してみました
環境
最初からこのサイトを見ていたら、すんなり設定出来たかも知れません
Zero-configuration Web Application Debugging with Xdebug and PhpStorm - PhpStorm - Confluence
Apache - PHP連携は省略します、、、
Xdebug
http://xdebug.org/download.php
Vista32bit版&PHP 5.3.25(Thread Safe)を使用しているので、PHP 5.3 VC9 TS (32 bit)を選択
http://www.xdebug.org/files/php_xdebug-2.2.3-5.3-vc9.dll
ダウンロードしたdllをPHPのインストールdir(%PHP_HOME%)のextに移動
C:\Program Files\PHP\ext>ls php_xdebug-2.2.3-5.3-vc9.dll php_xdebug-2.2.3-5.3-vc9.dll
php.ini
設定
以下を追加
xdebug.profiler_output_dirは存在dirであれば何処でも
[xdebug]
zend_extension="C:\Program Files\PHP\ext\php_xdebug-2.2.3-5.3-vc9.dll"
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.profiler_enable=1
xdebug.profiler_output_dir=C:\tmp\xdebug
確認
phpinfo();でも出来ますが、コマンドでもいけます
>php -v PHP 5.3.25 (cli) (built: May 8 2013 19:16:49) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
PhpStorm
File→Settings→PHPを選択し、インストールしたPHPをInterpreterを指定
File→Settings→PHP→Debugを選択し、XdebugのDebug portがphp.iniのxdebug.remote_portと一致することを確認後、
画面下部の"Use debugger bookmarklets to initiate debugger from your favorite browser"のリンクを選択
選択後、http://www.jetbrains.com/phpstorm/marklets/に遷移
画面下部のStart debuggerとStop debuggerをブックマーク保存
実行
1. Run→Start Listen PHP Debug Connectionsを選択
ToolbarでもOK
2. ブレイクポイントを設定
3. (対象画面を表示した状態で)ブックマーク保存したStart debuggerを選択
4. 画面操作
止まった!