zend studio 使用断点调试

1, 下载 Xdebug

1 # 下载地址
3  
4 # 寻找和自己所安装的 php 版本对应的 Xdebug 下载
5 # 对于 Windows 版本的 php 可以查看 phpinfo() 函数的打印信息, 查找"PHP Extension Build", 看你的 PHP 版本是 VC 几的,

2, 安装

1 # 安装说明页
3  
4 # 对于 Windows 版本, 下载完成后将下载的 dll 文件重命名为 php_xdebug.dll
5 # 将其复制到 PHP 的扩展目录中去 (例如: D:\Program Files\EasyPHP-5.3.2i\php\ext\ )

3, 修改 php.ini

01 # 在 php.ini 尾部增加一段, 改完之后重启 Web-Server
02 [Xdebug]
03 zend_extension="D:/Program Files/EasyPHP-5.3.2i/php/ext/php_xdebug.dll"
04  
05 xdebug.profiler_enable=on
06 xdebug.trace_output_dir="E:/xdebug"       ;xdebug 的数据文件目录
07 xdebug.profiler_output_dir="E:/xdebug"    ;xdebug 的数据文件目录
08 xdebug.max_nesting_level = 10000          ;如果设得太小,函数中有递归调用自身次数太多时会报超过最大嵌套数错
09  
10 xdebug.remote_enable=true                 ;Xdebug允许远程IDE连接
11 xdebug.remote_host=127.0.0.1              ;允许连接的zend studio的IP地址
12 xdebug.remote_port=9000                   ;反向连接zend studio使用的端口
13 xdebug.remote_handler=dbgp                ;用于zend studio远程调试的应用层通信协议

4, 修改 Zend Studio 设置

1 Window -> Preferences -> PHP -> Debug
2 # 将左侧 "Default Settings" 中的 "PHP Debugger" 设置为 "XDebug"

5, 在项目中新建一个 test.php 文件

1 <?php
2 for ($i = 0; $i < 10; $i++) {
3     if ($i==5) {
4         echo 'aa';
5     }
6 }
7 ?>

6, 新建一个 Debug 命令

1 # 点击工具栏上"小蜘蛛"旁边的小箭头 -> Debug As -> PHP Web Page
2 # 会跳出 Debug 视图
3 # 在 "if ($i==5) {" 这一行前面加一个断点, 就可以进行单步调试了
原文地址:https://www.cnblogs.com/phpcoder/p/4462134.html