XDebug 配置

xdebug.idekey="PHPSTORM"

xdebug.remote_handler = "dbgp"

xdebug.remote_mode = "req"

xdebug.remote_host=127.0.0.1

xdebug.remote_enable=on

xdebug.remote_port = 9001

xdebug.trace_output_dir ="/tmp/xdebug5.3"

xdebug.remote_autostart = no

PHPStorm设置

服务器配置完成后,需要对PHPStorm作一些设置,使其能够监听到浏览器的请求。

1、进入File>Settings>PHP,设置本地的php解释器,解释器一般指的是php的二进制文件,windows下的php安装路径下的php.exe,类unix系统下就是bin/php文件

1.png

2、进入File>Settings>PHP>Servers,这里要填写服务器端的相关信息

Host指的是http服务器上配置的项目的访问域名,我本地nginx配置的是test.yii.com,用的是默认的80端口


2.png

3、进入File>Settings>PHP>Debug,找到XDebug选项卡

Debug port 填写的是上文中,php.ini配置文件当中xdebug.remote_port那一项的值
3.png

4、进入File>Settings>PHP>Debug>DBGp Proxy

IED key填写的值是php.ini文件中xdebug.idekey的值,Host、Port是File>Settings>PHP>Servers中设定的Host、Port值
4.png

5、点菜单栏的Run>Edit Configurations… 在弹出的窗口中添加一个调试配置:

点击左上角加号,选择PHP Web Application
5.png

安装浏览器插件

建议使用Chrome浏览器,安装 xdebug helper插件, 下载好之后点选项,IDE选PHPSTORM
6.png