琢磨了一陣編輯器,然後要要開始準備寫程序,於是debug的日程就提上來了,這次是搭建基於vim 的php編輯平臺 ...
--------------------------------------------------------------------------------
| System | CentOS 5.7
--------------------------------------------------------------------------------
| Editor | Vim 7.3.456
--------------------------------------------------------------------------------
首先建議自己編譯vim 的版本,因爲其中需要開啓+python 和 +sign的支持,還是建議在虛擬機的linux 裏或者是在開發機上玩好點 ...
配置VIM
CentOS 5.7 上的python 是 2.4版的,我是夠用了,如果需要2.6或者3.0可以另外自行安裝
#yum install python-devel python mercurial
#cd vim
#./configure --prefix=/usr/local/vim --with-features=huge --enable-multibyte --enable-cscope --enable-gui=gtk2 --enable-pythoninterp=yes --with-python-config-dir=/usr/lib/python2.4/config
#vim /etc/profile|- alias vim="/usr/local/vim/bin/vim"
#vim # 進入命令模式:version 查看是不是有 +python 和 +sign,有的話恭喜,沒的話google ...
vim DBGp插件的安裝
http://www.vim.org/scripts/script.php?script_id=2508
install details
just copy the debugger.py and debugger.vim to the plugin directory in your home directory
$ tar -xzvf debugger.tar.gz
$ cp plugin/debugger.* ~/.vim/plugin/
配置 xdebug
#/tmp/lnpp/php/bin/pecl install xdebug
#vim /tmp/lnpp/php/etc/php.ini
[Zend]
zend_extension="/tmp/lnpp/php/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
xdebug.remote_enable=1
;xdebug.remote_handler=dbgp
xdebug.remote_port = 9001
xdebug.remote_host = localhost
注意zend_extension爲你自己的路徑
然後重啓php後臺服務...
#/tmp/lnpp/php/bin/php -m
查看是不是
[php]
Xdebug
...
[Zend Modules]
Xdebug
這樣就可以開始debug 了...
#cd /tmp/lnpp/nginx/html/
#vim phpinfo.php#vim ~/.vimrc |- let g:debuggerPort=9001
把光標停在所要設置斷點的行,進入命令模式:Bp設置斷點 ...
接下來按 F5 開始監聽,圖示如下:
格式爲:網頁地址?XDEBUG_SESSION_START=1
詳細可移步以下 :
http://download.csdn.net/detail/qzier_go/4106469
建立了一個lnpp羣,歡迎一起學習(QQ羣號:213572677)
2012/4/5修訂
php.5.4版本,安裝xdebug前先設置 php.ini 的location
#/tmp/lnpp/php/bin/pear
config-set /tmp/lnpp/php/etc/php.ini
#/tmp/lnpp/php/bin/pecl config-set /tmp/lnpp/php/etc/php.ini
#/tmp/lnpp/php/bin/pecl
install xdebug
Build process completed successfully
Installing '/tmp/lnpp/php/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so'
install ok: channel://pecl.php.net/xdebug-2.2.0RC1
Extension xdebug enabled in php.ini
之後打開php.ini 來進行修改
[xdebug]
zend_extension="/tmp/lnpp/lnpp-0.05/php/php-5.4.0/lib/php/extensions/no-debug- non-zts-20100525/xdebug.so"
;xdebug.show_local_vars=1
xdebug.remote_enable=on
;xdebug.remote_autostart=1
xdebug.remote_handler=dbgp
;xdebug.remote_host=localhost
xdebug.remote_port=9002
xdebug.remote_connect_back = 1
xdebug.remote_log=/var/log/xdedug.log
如果需要卸載就用
#/tmp/lnpp/php/bin/pecl
uninstall xdebug
xdebug 的官方網站有些資料
Reference :