Zend Studio单步调试

0x00 配置步骤

1.需求

用过VS 调试C++程序,Eclipse 调试java程序。而php语言作为“世界上最好的语言”。岂能没有调试功能?
对于开发和分析php代码,有动态断点调试可以大大加快我们开发的进度。

2.环境

  • wamp (php5.3.10 Apache2.2.21 mysql5.5.20)
  • zend studio 10.1
  • php_xdebug-2.1.2-5.3-vc9(wamp 自带)

3.配置

单步调试php需要xdebug支持,而wamp默认情况下是没打开远程调试的。所以需要按照下面简单配置下。 注意:wamp存在两处php.ini,两个地方都配置一下。

1
D:\wamp\bin\apache\Apache2.2.21\bin和D:\wamp\bin\php\php5.3.10

mark一下我的配置文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
xdebug.remote_enable = on
;允许连接的zend studio的IP地址
xdebug.remote_host = 127.0.0.1
;;反向连接zend studio使用的端口
xdebug.remote_port = 9000
;;用于zend studio远程调试的应用层通信协议
xdebug.remote_handler = dbgp

;以下是参数
xdebug.auto_trace = on
xdebug.collect_params = on
xdebug.collect_return = on
xdebug.trace_output_dir = "D:/wamp/tmp"

xdebug.profiler_enable = on
xdebug.profiler_output_dir = "D:/wamp/tmp"
xdebug.profiler_enable_trigger = on
xdebug.profiler_output_dir = "D:/wamp/tmp"
xdebug.profiler_output_name = cachegrind.out.%t.%p

配置好后,查看一下phpinfo()的xdebug配置信息:

0x01 Zend Studio 使用单步调试

1.zend studio默认Debug配置

  • windows => preferences => php => Debug,调成xdebug模式。
  • project => properties , 调成xdebug模式。

2.项目run

  • debug as php web application

  • 断点调试

现在只需在zend浏览器中,输入自己的地址等操作,即可在自己设置的断点停下调试。

0x02 想法

网上查阅了许多资料,结合了一下。自己将最简单的过程记录下来,其实关键在两个php.ini都配置。然后,通过phpinfo查看~~

文章作者: angelwhu
文章链接: https://www.angelwhu.com/paper/2015/07/27/zend-studio-stepping/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 angelwhu_blog