一、運行環境
nginx 1.0.14
php with fpm-cgi 5.5.9
mac os Xphp
二、安裝步驟
1)install xdebug
nginx
wget http://xdebug.org/files/xdebug-2.2.3.tgz tar xzvf xdebug-2.2.3.tgz && cd xdebug-2.2.3 /path-to-your-php-root/bin/phpize ./configure –enable-xdebug –with-php-config=/path-to-your-php-root/bin/php-config
修改你的php.ini配置,添加:
zend_extension=/server/php/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so
xdebug.idekey=」PHPSTORM」
xdebug.remote_host=127.0.0.1
;注意端口爲9001,默認爲9000,由於跟fpm衝突因此要修改
xdebug.remote_port=9001
xdebug.remote_enable=onshell
*/path-to-your-php-root/ 指你電腦裏php的安裝根目錄,注意替換。app
2)重啓fpm和nginx
kill -USR2 fpm主進程id(注意運行的用戶Id進行區分)
kill -USR2 nginx主進程id(注意運行的用戶Id進行區分)
或用其它命令重啓phpstorm
3)查看phpinfo()的輸出,確認xdebug安裝是否成功
ide
4)配置phpstorm
點擊功能菜單上的電話圖標,啓動「Start Listen for php debug connections」;url
設置斷點
用debug方式運行spa
5)效果
.net
三、總結
1)要注意fpm與xdebug的端口衝突問題,它們都使用了9000,要修改其中一個;
2)即便是本機運行xdebug,也要注意它是remote debug的功能,要配置相關remote sever等;
3)本機的話,不須要配置url mapping
4)配置完後注意用phpstorm的驗證功能驗證
debug
四、參考
http://confluence.jetbrains.com/display/PhpStorm/Zero-configuration+Web+Application+Debugging+with+Xdebug+and+PhpStorm
做者
朱淦 350050183@qq.com