您的位置:首页 > 编程语言 > PHP开发

在PhpStorm中使用xdebug调试PHP代码

2015-07-27 16:08 866 查看
一、Windows平台

1、在php.ini增加一下代码,其中zend_extension为自己的php\ext\php_xdebug.dll全路径。在php.ini中修改extension_dir。

;[XDebug]
;; Only Zend OR (!) XDebug
zend_extension="D:\your-php-path\ext\php_xdebug.dll"
xdebug.remote_enable=on
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9001
xdebug.remote_handler=dbgp
xdebug.profiler_enable=1
xdebug.idekey="PHPSTORM"
xdebug.auto_trace=on
; On windows:
extension_dir = "D:\your-php-path\ext"
2、重启apache或者php-fpm。检验xdebug配置是否成功,要在phpinfo()中看到如下内容:





3、图中最上面的IDK Key还不会显示PHPSTORM,在PhpStrom中配置后就会出现。如下在PhpStorm中配置xdebug:

a、打开设置(Ctrl+Alt+s)













b、在run中选中调试



c、xdebug.remote_port端口很重要,一定要和phpstorm中配置相匹配。

二、OSX平台

1、在osx平台中,php和php-fpm、php-xdebug是默认安装的。配置php.ini和phpstorm是类似的。





2、别忘了重启php-fpm

3、phpstrom配置和Windows的一样
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  xdebug phpstorm