首页 > 编程 > PHP > 正文

PHP XDebug Sublime Text 单步调试

2020-03-24 18:54:01
字体:
来源:转载
供稿:网友
  • 前置环境:已经安装好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文件加载顺序

    PHP编程

    郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。

  • 发表评论 共有条评论
    用户名: 密码:
    验证码: 匿名发表