1,xdebug
我是直接用的xampp,所以xdebug.dll是已经有了的。如果没有,或编译或下载去
2,php.ini
下载的xampp也已经有了如下代码,只需要取消注释即可。
[XDebug]zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "C:\xampp\tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = On
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.trace_output_dir = "C:\xampp\tmp"
xdebug.idekey = PHPSTROM
xdebug.remote_port = 9000
如果没有以上配置,添加之,然后修改相应自己背地的路径。
**注意,xampp自带的配置中 xdebug.remote_enable 设置的是 0,需将其设置为1或On。(我就是在这里消耗了好多的脂肪)
3,phpstrom
a)File->Setting->Language & Frameworks->PHP->Servers 点击“+”号添加一个server,类似:
b)File->Setting->Language & Frameworks->PHP->Debug界面中,Debug port和php.ini文件中配置的xdebug.remote_port值一致
c)Run->Edit Configurations界面左上角中,点击“+”号,类似
d)File->Build,Executin,Deployment->Debugger的port不用管
4)chrome
谷歌扩展中搜索xdebug helper,找到xdebug helper。注意不是Xdebug这个扩展
添加完成后,点击xdebug helper插件的选项,在其设置页面中设置IDE key为PhpStrom(大小写无所谓)
如果不出意外,加上断点就可以调试了,如果出了问题,请不要找我。