phpStorm配置xdebug調試總結 [Mac/Linux]____Linux

來源:互聯網
上載者:User

本人習慣netbeans-xdebug調試

我是在Mac本上開發, 大家linux配置xdebug也可以參考


我的php 是通過mac homebrew 安裝,所以xdebug的安裝我也是用homebrew  (類似 linux wget / yum)

直接進入話-操作命令步驟如下:

1 mac 安裝homebrew :ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2 配置php.ini

   (1)查看php 版本: php -v (5.3/5.4/5.6/..)

   (2)brew search xdebug
            homebrew/php/php53-xdebug     homebrew/php/php54-xdebug   homebrew/php/php55-xdebug homebrew/php/php56-xdebug

     (3)   brew install homebrew/php/php55-xdebug      (選擇與php版本相符的xdebug)

     (4)   找到xdebug.so檔案路徑 (/usr/local/Cellar/php55-xdebug/2.3.3/xdebug.so)

     (5)   找到php.ini檔案 (php -i | grep php.ini)  

Configuration File (php.ini) Path => /usr/local/etc/php/5.5
Loaded Configuration File => /usr/local/etc/php/5.5/php.ini

     (6)   修改php.ini 增加一下配置

            zend_extension="/usr/local/Cellar/php55-xdebug/2.3.3/xdebug.so"
      xdebug.remote_enable=1
            xdebug.remote_host=localhost
      xdebug.remote_port=9000
      xdebug.remote_handler=dbgp

     (7) 重啟php: /usr/sbin/php-fpm restart

3 配置phpStorm

   (1)進入Preferences


     (2)  ->Build,Execution,Deployment->Deployment-> "+" ->Add Server    ,Name 自訂名稱, Type選擇 In place

       

      


    (3)



4

點擊Validate remote environment  進行 validate ,information顯示全綠/藍  沒有警告,說明validate通過


5

PHP -> Debug 

右側 Xdebug 配置 

Debug port:9001

其他項不勾選

#############圖片不知怎麼回事上傳不上去#########

6

PHP -> Debug -> DBGp Proxy

IDE key: (phpinfo裡搜xdebug,查看顯示的IDE Key ,寫在這裡)

Host: 調試項目的地址

Port:9001


7

Run -> Edit Configutations

進入後 左側 點"+" 添加PHP Web Applications ,

右側:

name 隨便起

Configuration

Sever:選擇之前配置的 PHP Server

Start URL:調試項目地址 (http://xxxx)

Browser: 推薦Chrome(支援phpstorm外掛程式)


大功告成,在index.php某處加上斷點,Run->Debug 就會跳到斷點處;

如果想測試 某個控制器的某個方法,可以在方法中加上斷點 然後Debug 跳轉到瀏覽器,此時在url上加上請求的控制器,方法,參數即可跳到斷點處;

謝謝~,希望對你們有協助,如果有不足之處,忘請見諒,圖片這個頭次傳,真心不能都傳上去,以後好好研究。



9


10

完成~~~~~~  轉載請註明 來源:   作者辛苦的勞動成果          

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.