·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> 网站建设开发 >> php网站开发 >> PHPXDebugSublimeText单步调试

PHPXDebugSublimeText单步调试

作者:佚名      php网站开发编辑:admin      更新时间:2022-07-23

前置环境:已经安装好LNMP

1. 安装xdebug

可以通过pear包管理来安装

sudo apt-get install php-pear

sudo pecl install xdebug

这里我们直接通过apt安装

apt-get install php5-xdebug

程序已经自动创建了默认的配置文件

配置:

xdebug.ini位置:/etc/php5/mods-available/xdebug.ini

新增如下

 

zend_extension="/usr/lib/php5/20131226/xdebug.so"

xdebug.PRofiler_output_dir=/tmp

xdebug.profiler_output_name=cachegrind.out.%p

xdebug.profiler_enable_trigger=1

xdebug.profiler_enable=true

xdebug.remote_enable=true

xdebug.remote_host=127.0.0.1

xdebug.remote_port=9000

xdebug.remote_handler=dbgp

xdebug.remote_mode = req

xdebug.remote_connect_back = 1

xdebug.remote_autostart=0

xdebug.collect_vars = On

xdebug.collect_params = On

xdebug.auto_trace = On

xdebug.show_exception_trace = On

xdebug.trace_output_dir=/tmp

重启PHP5-FPM

/etc/init.d/php5-fpm restart

2. 开启调试


sublime 中 CRL+ALT+F9 打开调试界面

查看端口 9000

 

3.测试

创建文件test.php

 

<?php

    for ($i=0; $i < 10; $i++) { 

        echo $i;

    }

?> 

 

在浏览器里访问 http://127.0.0.1/test.php

 

 

可以看到我们断点的地方 $i = 0

Shift+f8: 打开调试面板
f8:打开调试面板快速连接
Ctrl+f8: 切换断点
Ctrl+Shift+f5: 运行到下一个断点
Ctrl+Shift+f6: 单步
Ctrl+Shift+f7: 步入
Ctrl+Shift+f8: 步出

 

CTRL+SHIFT+F7 

 本文地址:http://www.cnblogs.com/martin-tan/p/4921200.html

PHP X-Debug的文件 

Ubuntu下面有KCachegrind直接打开,方便trace文件加载顺序