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

在Intellij IDEA或者PhpStorm下用X-debug调试PHP

2015-05-29 00:00 821 查看
用Intellij IDEA或者PhpStorm使用X-debug来调试PHP,主要需要配置的部分有三个地方,分别为php.ini的配置,IDEA的配置和浏览器的配置,主要如下,以备忘:

php.ini的主要配置如下所示,关键参数根据实际情况可以修改:
[Xdebug]
zend_extension_ts=”X:/App/php-5.2.17-Win32-VC6-x86/ext/php_xdebug-2.1.1-5.2-vc6.dll”
xdebug.remote_host=jichengdiaoding.com
xdebug.remote_port = 9000
xdebug.remote_mode = “req”
xdebug.remote_enable = on
xdebug.remote_handler = dbgp
xdebug.idekey = “netbeans-xdebug”
xdebug.profiler_enable=on
xdebug.trace_output_dir=”X:/App/php-5.2.17-Win32-VC6-x86/xdebuginfo”
xdebug.profiler_output_dir=”X:/App/php-5.2.17-Win32-VC6-x86/xdebuginfo”
xdebug.auto_trace=on
xdebug.collect_params=on
xdebug.collect_return=on
xdebug.show_exception_trace = On
xdebug.remote_autostart = On
xdebug.collect_vars = On配置好了,在CMD里面输入X:/App/php-5.2.17-Win32-VC6-x86/php.exe -m,如果能看到XDebug模块,说明开启成功。
*: 值得注意的是,这里需要确定好XDebug和PHP的对应版本

IDEA的配置如下:
进入File>Settings>PHP>Servers,这里要填写服务器端的相关信息,name填要调试的主机名 (如:jichengdiaoding.com或者localhost等),host填(如:localhost或者amiku.cn等),port填 80,debugger选XDebug



进入File>Settings>PHP>Debug,看到XDebug选项卡,port填9000,其他默认



进入File>Settings>PHP>Debug>DBGp Proxy,IDE key 填 netbeans-xdebug,host 填jichengdiaoding.com,port 填80




在Firefox或者Chrome浏览器中,找到对应的X-Debug版本的插件,如下为Firefox下的调试插件:



工具的设置里的IDE KEY填上netbeans-xdebug,把jichengdiaoding.com加入到白名单,以后调试的时候把工具启用就好了



在IDEA中打开PHP的监听,然后就可以进入debug模式,方便的打断点和查看变量以及监测等。




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