today's offers - xanax use in pregnancy xanax xr be abused soma internet pharmacies fedex soma without priscription fed ex phentermine parkinson drugs phentermine baclofen tramadol together ordering tramadol cod viagra find search 76k cialis pages cialis buy on line viagra for sale without a prescription buy onlinecom phentermine viagra ambien and klonopin drug interaction buy ambien overnight cheap online pharmacies valium saturday delivery valium online with no prescription or membership fioricet overnight no rx cheap fioricet without a prescription order meridia cod fedex meridia cheap fed ex delivery xanax bradycardia what does xanax look like american soma how to buy soma online without prescriptin phentermine overnight echeck c o d 375 mg phentermine rss feed cheap no prescription tramadol stop the tramadol generic prices online cialis generic cialis fedex chinese herbal viagra taking partial pill of viagra ambien and pregnancy smoking ambien cod online valium buy cheap valium without prescription no prescription fioricet with fedex fioricet without prescription in Brasilia order meridia meridia information

在vim 下debug php (use xdebug)


1.VIM 的部份
在你的vim 下
:version
看看有沒有+python 和+sign
沒的話….
把vim 重裝…
#make install WITH_PYTHON
這樣應該就會有了…

2.安裝Script
去這個地方抓

http://www.vim.org/scripts/script.php?script_id=1929

放到/usr/local/share/vim/vim71/plugin/底下…

3.安裝xdebug
#cd /usr/ports/devel/php-xdebug
#make install
#vim /usr/local/etc/php.ini

[Zend]
zend_extension = /full/path/to/xdebug.so
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.remote_host = localhost

加入上面這幾行..
看一下phpinfo 有沒有出現xdebug

4.
然後開browser run你的url 後面的?XDEBUG_SESSION_START=1 這是重點..
例如 http://example.com/index.php?XDEBUG_SESSION_START=1

5.
#vim xxx.php
然後按F5
下面就會出現
waiting for a new connection on port 9000 for 5 seconds
然後這時後你有五秒去開你的url
例如

http://example.com/xxx.php

再回去看你的vim 就開始在debug ……….

到這邊就差不多了…

PS
1.
如果phpinfo 告訴你
XDEBUG NOT LOADED AS ZEND EXTENSION
那這樣是沒辦法…..去debug 的雖然可以F5 去跑..
不過step over 之類的都不能用…

2.
因為…我在vim 下按 F2 F3 會轉換大小寫…和他的function key 有衝到…
去看debugger.vim 下..
他有這段
map <Leader>dr :python debugger_resize()<cr>
map <Leader>di :python debugger_command(’step_into’)<cr>
map <Leader>do :python debugger_command(’step_over’)<cr>
map <Leader>dt :python debugger_command(’step_out’)<cr>

<Leader> = \
所以我step over 是用 \do
以此類推..

希望對有用vim 的同好有幫助 。
^^
我終於可以脫離”print 大法”了…..

Ref.
http://2bits.com/articles/using-vim-and-xdebug-dbgp-for-debugging-drupal-or-any-php-application.html
How do debug php with vim and xdebug on linux

, ,

  1. #1 by gala4th on November 5, 2009 - 4:00 am

    嘗試了好一段時間,如果有這樣的設定:

    map :python debugger_command(’step_into’)

    那麼,直接用 vim ,然後按 F2 是正常的

    但是,如果是 GNU screen + vim ,按 F2 則會會變成 “轉換大小寫” 的功能

    另個解決方法是:
    map ^[[12~ :python debugger_command(’step_into’)

    注意,輸入的方式是 press the key followed by F2 key

    Reference: http://vim.wikia.com/wiki/Mapping_keys_in_Vim_-_Tutorial_%28Part_2%29

  2. #2 by gala4th on November 5, 2009 - 4:03 am

    系統會把 tag 吃掉,重貼一次

    嘗試了好一段時間,如果有這樣的設定:

    map <F2>:python debugger_command(’step_into’)<cr>

    那麼,直接用 vim ,然後按 F2 是正常的

    但是,如果是 GNU screen + vim ,按 F2 則會會變成 “轉換大小寫” 的功能

    另個解決方法是:
    map ^[[12~ :python debugger_command(’step_into’)<cr>

    注意,輸入的方式是 press the key followed by F2 key

  3. #3 by johnpupu on November 13, 2009 - 5:52 pm

    gala4th :

    系統會把 tag 吃掉,重貼一次

    嘗試了好一段時間,如果有這樣的設定:

    map <F2>:python debugger_command(’step_into’)<cr>

    那麼,直接用 vim ,然後按 F2 是正常的

    但是,如果是 GNU screen + vim ,按 F2 則會會變成 “轉換大小寫” 的功能

    另個解決方法是:
    map ^[[12~ :python debugger_command(’step_into’)<cr>

    注意,輸入的方式是 press the key followed by F2 key

    感謝你的提醒^^

(will not be published)

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word