タイトルの件。私の環境の場合です。
PhpStorm 9.0.2
vagrant 1.7.4
(http://192.168.33.10/ で動いてる)
vagrantが起動しているディレクトリで、sshに入る
$ vagrant ssh
xdebug.iniを見つけて編集し、Apatchを再起動
[vagrant@localhost ~]$ cd /etc/php.d/x
xdebug.ini xml_wddx.ini xmlwriter.ini
xml.ini xmlreader.ini xsl.ini
[vagrant@localhost ~]$ sudo vi /etc/php.d/xdebug.ini
ーーーここでの追記内容は下記ーーー
[vagrant@localhost ~]$ sudo service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
追記内容
zend_extension=/usr/lib64/php/modules/xdebug.so
xdebug.remote_enable=1
xdebug.remote_port="9000"
xdebug.default_enable=1
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
xdebug.profiler_enable=1
xdebug.profiler_output_dir="/tmp"
xdebug.max_nesting_level=1000
xdebug.idekey = "PHPSTORM"
次に、PhpStorm側に接続環境を保存する。
PhpStormのメニュー
Preferences > Languages & Frameworks > PHP > Servers で、
Host:192.168.33.10
Port:80
Debugger:Xdebug
として、
User path mappings にチェックし、/vagrant フォルダを指定する
あと、Run/Debug Configurationsを追加します。(15/10/19追記)
(右上のデバッグぽいアイコンの列にプルダウンがあって、
Edit Configurations... が選べるはず。)
+ボタンを押して、
PHP Remote Debug
を選択。
Servers : 192.168.33.10
Ide key : PHPSTORM
としてOKする。
念のため、もうひとつやってることがあります。
PhpStormでデバッガを起動したら、
同時にブラウザ側にブックマークで保存してるjsも動かしています。
start debugger
javascript:(/** %40version 0.5.2 */function() %7Bdocument.cookie%3D%27XDEBUG_SESSION%3D%27%2B%27PHPSTORM%27%2B%27%3Bpath%3D/%3B%27%3B%7D)()
stop debugger
javascript:(/** %40version 0.5.2 */function() %7Bdocument.cookie%3D%27XDEBUG_SESSION%3D%27%2B%27%27%2B%27%3Bexpires%3DMon, 05 Jul 2000 00:00:00 GMT%3Bpath%3D/%3B%27%3B%7D)()
他の方の参考になるかどうかw
完全に自分用のメモです。