PHPXDebugSublimeText单步调试

王朝学院·作者佚名  2016-08-27
窄屏简体版  字體: 小  |  中  |  大  |  超大  

前置环境:已经安装好LNMP

1. 安装xdebug

可以通过pear包管理来安装

sudo apt-get installphp-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文件加载顺序

 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝網路 版權所有 導航