PHPStorm下XDebug配置

 

1安裝Xdebug

用yum安裝可能會失敗,用pecl安裝成功。php

#yum installphp-pecl-xdebug.x86_64html

pecl installxdebug
         若是pecl命令不存在請先安裝php-pear
         命令:yum install php-pearexpress

注意多加了一項IDE Key,且要與後面PHPStorm中的配置相同:瀏覽器

zend_extension=/path/xdebug.so服務器

zend_debugger.allow_hosts=10.25.1.199phpstorm

zend_debugger.expose_remotely=alwayside

zend_debugger.httpd_uid=-1工具

xdebug.auto_trace = on ui

xdebug.auto_profile = on lua

xdebug.collect_params = on

xdebug.collect_return = on

xdebug.profiler_enable = on

xdebug.trace_output_dir = "/tmp"

xdebug.profiler_output_dir ="/tmp"

xdebug.dump.GET = *

xdebug.dump.POST = *

xdebug.dump.COOKIE = *

xdebug.dump.SESSION = *

xdebug.var_display_max_data = 4056

xdebug.var_display_max_depth = 5

xdebug.remote_enable=on       

xdebug.remote_handler=dbgp

xdebug.remote_host=10.25.1.199

xdebug.remote_port=9010

xdebug.remote_autostart=1

xdebug.idekey="PHPSTORM"

 

2配置PHPStorm


圖1:首先配置PHP解釋器的路徑

 


圖2:File>Settings>PHP>Servers,這裏要填寫服務器端的相關信息,name填localhost,host填localhost,port填80,debugger選XDebug

 


圖3:進入File>Settings>PHP>Debug,看到XDebug選項卡,port填9010,其餘默認

 


圖4:進入File>Settings>PHP>Debug>DBGpProxy,IDE key填PHPSTORM,host填localhost,port 填80

 


圖5:在phpStorm裏打開監聽,就是一個電話同樣的按鈕

 


圖6:在瀏覽器裏打開XDebug工具,訪問localhost,與phpStorm鏈接成功!

 

3常見問題

訪問頁面準備進入斷點時,PHPStorm報錯:Cannot accept external Xdebug connection: Cannot evaluate expression'isset($_SERVER['PHP_IDE_CONFIG'])';

 

致使此問題的一個可能緣由是:服務器端的php.ini中配置了:

         extension=/path/xdebug.so

應該只保留下面一個:

         zend_extension=/path/xdebug.so

 

參考資料

1 phpStorm+XDebug進行斷點調試的配置

http://www.chenxuanyi.cn/xampp-phpstorm-xdebug.html

 

2利用下面網頁中的Start debug按鈕在COOKIE中設置Xdebug所需的變量。

http://www.jetbrains.com/phpstorm/marklets/

 

3 Cannot accept external Xdebug connection:Cannot evaluate expression 'isset($_SERVER['PHP_IDE_CONFIG'])

http://devnet.jetbrains.com/message/5463083?tstart=0

相關文章
相關標籤/搜索