Xdebug+Phpstorm配置使用
2016-01-20 10:56:15 星期三
工具:
- XAMPP
- PHPSTORM10.0.1
- Firefox(扩展:The easiest Xdebug、Firebug)
1. php.ini配置
[XDebug]
zend_extension = "D:\xampp\php\ext\xdebug.dll"
;xdebug.profiler_append = 0
;xdebug.profiler_enable = 1
;xdebug.profiler_enable_trigger = 0
;xdebug.profiler_output_dir = "\xampp\tmp"
;xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.remote_port = "9000"
;xdebug.trace_output_dir = "\xampp\tmp"
xdebug.idekey="PhpStorm"
说明:
- XAMPP自带xedbug扩展,只需要在Php.ini中启用即可
xdebug.remote_port = "9000"PHPSTORM中需要设置端口为9000,File -> Languages & Frameworks -> PHP -> Debug -> Xdebug:debug port 9000(保持默认即可)
![]()
2. 测试使用
- 重启apache服务器
- 编写测试文件test.php
phpinfo()输出的信息中会包含下面的内容
![]()
- Xdebug的配置相关信息
![]()
3.PHPSTROM+Xdebug调试简单使用
- phpstorm中相关操作
开始调试:
- 启用监听debug9000端口
![]()
- 添加断点
- 双击变量可以查看变量信息
- 控制台(①停止调试;②逐步执行;③进入到函数)
![]()
关闭调试:单击停止调试按钮,关闭监听,清楚Firefox中的调试cookie
2.Firefox相关操作
-
启用The easiest Xdebug插件,设置“Ide key for remote debugging”和PHP.ini文件中设置的
xdebug.idekey="PhpStorm"相同
![]()
-
点击甲虫图标生成调试cookie
![]()
-
查看cookie是否成功生成
![]()









浙公网安备 33010602011771号