第九节 PHP 跟踪调试代码 XDebug
最后更新于:2022-04-02 01:47:13
>[success] # PHP 跟踪调试代码 XDebug
- [下载XDebug扩展](https://xdebug.org/download.php)
- 下载对应PHP版本的Xdebug
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/c17f1f1e965522c2fe1411e1759e4447_870x524.png)
- 线程安全(TS)和非线程安全(NTS)
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/24efc18d4299f35a0618e8566751692c_834x139.png)
- 安装Xdebug扩展-php.ini
```
[XDebug]
xdebug.profiler_output_dir="D:\phpStudy\tmp\xdebug"
xdebug.trace_output_dir="D:\phpStudy\tmp\xdebug"
zend_extension="D:\phpStudy\php\php-7.1.7-nts-64\ext\php_xdebug-2.5.3-7.1-vc14-nts-x86_64.dll"
xdebug.idekey=PHPSTORM
xdebug.remote_port=9005
xdebug.remote_enable=on
```
- 配置PHPStorm
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/24efc18d4299f35a0618e8566751692c_834x139.png)
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/51b711b3bbc9249174ffce1a4b9f945b_1029x779.png)
- 配置Debug
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/1edc8f99d4ef5ba2716c67ee7cde5b1f_1085x698.png)
- 运行Debug
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/28d7820fd72af5b2b500f0c038cff27b_425x134.png)
- 调试
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/36e26a415303e32f1832bbc850ee2dd7_1887x727.png)
- return 处 Step into F7 跳进去
> ### 相关阅读
- [为PHPStorm配置Xdebug调试环境](http://blog.csdn.net/zhyh1986/article/details/45172685)
- [Configure Xdebug Helper for Chrome to be used with PhpStorm](https://confluence.jetbrains.com/display/PhpStorm/Configure+Xdebug+Helper+for+Chrome+to+be+used+with+PhpStorm)
';