Xdebug+Phpstorm配置使用

2016-01-20 10:56:15 星期三

工具:

  1. XAMPP
  2. PHPSTORM10.0.1
  3. 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"

说明

  1. XAMPP自带xedbug扩展,只需要在Php.ini中启用即可
  2. xdebug.remote_port = "9000"PHPSTORM中需要设置端口为9000,File -> Languages & Frameworks -> PHP -> Debug -> Xdebug:debug port 9000(保持默认即可)
2. 测试使用
  1. 重启apache服务器
  2. 编写测试文件test.php
    • phpinfo()输出的信息中会包含下面的内容
    • Xdebug的配置相关信息
3.PHPSTROM+Xdebug调试简单使用
  1. phpstorm中相关操作
    开始调试
  • 启用监听debug9000端口
  • 添加断点
  • 双击变量可以查看变量信息
  • 控制台(①停止调试;②逐步执行;③进入到函数)

    关闭调试:单击停止调试按钮,关闭监听,清楚Firefox中的调试cookie

2.Firefox相关操作

  • 启用The easiest Xdebug插件,设置“Ide key for remote debugging”和PHP.ini文件中设置的xdebug.idekey="PhpStorm"相同

  • 点击甲虫图标生成调试cookie

  • 查看cookie是否成功生成

posted @ 2016-01-26 10:34  小叔丶  阅读(251)  评论(0)    收藏  举报