today's offers - xanax xanax online without prescription taking viagra and xanax soma overnight cod no rx soma online delivery order phentermine next day phentermine hcl capsules buy tramadol cash on delivery tramadol hcl 50 mg tablet tev chinese viagra viagra discount online cialis online australia 20mg generic cialis pills buying ambien online ambien cautions for the elderly Valium overnight delivery no a rx overnight Valium order fioricet 250mg no rx fioricet canada buy cheap discounted Meridia Meridia overnight without prescription online xanax fedex overnight delivery getting prescribed to xanax buy cheap discounted soma soma delivered overnight cheap 37 5 phentermine best price for phentermine cheap tramadol no rx tramadol online no prescription fedex low cost viagra cheap viagra mail order cialis fast delivery generic cialis from philipines no rx ambien cod delivery fedex ambien without priscription no prescription required valium buy no prior perscription Valium

在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