phpstorm+Xdebug斷點調試PHP

運行環境:php

PHPSTORM版本 : 8.0.1html

PHP版本 : 5.6.2web

xdebug版本:php_xdebug-2.2.5-5.6-vc11-x86_64.dll服務器

ps : php版本和xdebug版本必定要相對應phpstorm

 點擊下載Xdebugide

1. PHP安裝xdebug擴展

php.ini的配置,下面的配置僅供參考,路徑要換成本身的!.net

[xdebug]debug

zend_extension="D:\wamp\php-5.6.2-x64\ext\php_xdebug-2.2.5-5.6-vc11-x86_64.dll"調試

xdebug.remote_enable = Onorm

xdebug.remote_handler = dbgp   

xdebug.remote_host= localhost

xdebug.remote_port = 9000

xdebug.idekey = PHPSTORM

ps : remote_handler 、remote_host、remote_port 這些都有默認值,但仍是建議設置下,至少知道要設置這些參數~

查看phpinfo~

 

【或者使用PHPstudy:其餘選項菜單/PHP擴展設置/PHP擴展/XDEBUG打上對鉤】

 

 

2.PHPSTORM設置

樓主之前一直用zendstudio,剛開始用phpstorm很是蛋疼,用了一段時間後發現還挺好用的~

        1.首先檢查phpstorm的xdebug配置

          這裏的debug port要和php.ini裏面的xdebug.remote_port相一致!默認是9000,若是9000端口被佔用的話,能夠改爲其餘端口。

                

phpstorm配置

  • 客戶端調試,打開phpStorm,進入File>Settings>PHP>Servers,這裏要填寫服務器端的相關信息,name填localhost,host填localhost,port填80,debugger選XDebug
  • 進入File>Settings>PHP>Debug,看到XDebug選項卡,port填9000,其餘默認
  • 進入File>Settings>PHP>Debug>DBGp Proxy,IDE key 填 phpStorm,host 填localhost,port 填80
  • 點OK退出設置。

 

            2. 設置debug.

            

           

添加本地的 web server~

 www.51open.pcom 是我本地的 web server~ ~

3.開始調試

  1. 打好第一個斷點,shift + F9就能夠了

  2. 打好第一個斷點,選中配置的debug,  按旁邊的臭蟲 按鈕

相關文章
相關標籤/搜索