配置PhpStorm調試PHP

配置PhpStorm調試PHPphp

第一步:配置 XDebughtml

下載安裝XDebug到本地環境(參考:Zend Studio 9.x + xampp + XDebug 調試環境安裝詳解),打開php.ini,參考配置以下:
[XDebug]
zend_extension = "D:\PHP\xampp2\php\ext\php_xdebug.dll"
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "D:\PHP\xampp2\tmp
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.remote_port=9000
xdebug.trace_output_dir = "D:\PHP\xampp2\tmp"git

備註:

PHPstudy等集成環境已經在各個版本中集成了xdebug,只須要在PHP拓展中勾選xdebug而後重啓服務便可直接使用。

第二步:配置PhpStorm中的 XDebugwindows

路徑:File -> Settings -> Languages & Frameworks -> PHP -> Debug瀏覽器

phpstrom-debug-02.png

第三步:配置PhpStorm中的 Server服務器

路徑:File -> Settings -> Languages & Frameworks -> PHP -> Serversapp

phpstrom-debug-01.png

注意:若是所謂的「遠程服務器」就在本地的話,就不須要勾選「Use path mappings(select if the servers is remote or symlinks are used)」phpstorm

第四步:設置調試項工具

點擊 以下圖所示的「下三角」按鈕,選擇 「Edit Configurations」,彈出「Run/Debug Configrations」對話框:post

phpstrom-debug-03.png

phpstrom-debug-04.png

第五步:開始調試頁面

點擊工具欄上的「電話按鈕」,開啓調試端口的監聽,而後點擊「甲殼蟲按鈕」,開始調試頁面。

phpstrom-debug-05.png

特別說明下:由於剛纔設置的是:開啓調試的時候,打開項目的「首頁」,因此當點擊「甲殼蟲按鈕」後,它會打開「首頁」。

不用管它打開了「首頁」,上面的動做只是爲了開啓PhpStorm的調試監聽功能,當咱們在瀏覽器中輸入要調試的頁面時(記得按「回車鍵」),如頁面 http://127.0.0.4:8088/home/Test/test,它會自動跳轉頁面的斷點處,以下圖所示:

phpstrom-debug-06.png

點擊調試按鈕,一步一步調試吧(快捷鍵 F5)!

經常使用的幾個快捷鍵

F5:Step Into

F6:Step Over

F7:Step Out

參考:

https://www.adayinthelifeof.nl/2012/12/20/debugging-remote-cli-with-phpstorm

延伸閱讀:

【總結2】PhpStorm利用XDebug調試PHP技巧

相關日誌:

VirtualBox安裝CentOS5.x中出現NET:Registered protocol family 2後卡住問題

【總結2】PhpStorm利用XDebug調試PHP技巧

初學UML用哪一個case工具?Rational Rose2007(v7.0)破解版下載

Intellij IDEA 14.x 中的Facets和Artifacts的區別

解決XP下「沒法經過windows installer服務安裝此安裝程序包。您必須安裝帶有更新版本Windows Installer服務的Windows Service Pack。」的問題

PHP最強大開發工具PhpStorm註冊碼收藏

【強烈推薦】利用NAT、Host-Only雙虛擬網卡,實現Virtual Box中CentOS6.3聯網

Zend Studio / Ecliplse插件EasyExplorer,打開資源文件所在的文件夾

Windows主機裏利用VMware安裝Linux(CentOS)虛擬機,Host-only鏈接上網方式詳解

Git的load putty key選項不可用(why-load-putty-key-is-disabled-in-tortoise-git)

文章轉載自:http://blog.snsgou.com/post-825.html

相關文章
相關標籤/搜索