琢磨了一阵编辑器,然后要要开始准备写程序,于是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.youkuaiyun.com/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 :