天天看點

phpstorm+xdebug配置PHP斷點調試

環境:win10+phpstudy。nginx+php5.6+phpstorm2016

安裝下載下傳略,phpstudy裡都帶了。

  • 配置php.ini
[XDebug]
zend_extension="D:\phpstudy\PHPTutorial\php\php-5.6.27-nts\ext\php_xdebug.dll"

xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir = "D:\phpstudy\PHPTutorial\tmp\xdebug"
xdebug.trace_output_dir="D:\phpstudy\PHPTutorial\tmp\xdebug"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
;xdebug.remote_autostart=on
xdebug.remote_enable = on
xdebug.remote_handler = "dbgp"
xdebug.remote_mode = "req"
;xdebug.remote_host = "127.0.0.1"
xdebug.remote_port=9100
;xdebug.show_local_vars=0
xdebug.idekey= PHPSTORM
           

注意:remote_host可以不配,會預設為localhost。路徑使用window的分隔符。9000端口會被php-cgi占用,改為9100.

[zend]項裡的zend_extension項的相對有問題,改為絕對路徑。

  • 重新開機,看phpinfo.有下圖這些就OK了。
    phpstorm+xdebug配置PHP斷點調試
  • 配置phpstorm。

    端口與php.ini裡的相一緻。

    phpstorm+xdebug配置PHP斷點調試
    DGBp,因為在本地。按圖配置即可。
    phpstorm+xdebug配置PHP斷點調試

    servers裡,要配置網站通路的域名,端口一般是80。

    這一步,如果在本地配置了hosts,搞了很多虛拟機,要特别注意了解一下。

    phpstorm+xdebug配置PHP斷點調試
    在Edit Configurations裡增加調試的站點。項目類型選php web application。填入自己剛才設定好的server即可。
    phpstorm+xdebug配置PHP斷點調試
    phpstorm+xdebug配置PHP斷點調試
    到這兒,就配置完畢了,如果你的網站之前是可以正常通路的,那麼在shift+f9時,即可以跳轉到chrome打開設定的域名。
php