程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> PHP編程 >> 關於PHP編程 >> PHP XDebug Sublime Text 單步調試,xdebugsublime

PHP XDebug Sublime Text 單步調試,xdebugsublime

編輯:關於PHP編程

PHP XDebug Sublime Text 單步調試,xdebugsublime


前置環境:已經安裝好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文件加載順序

 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved