phpstorm多端口调试
在存在多个项目的时候,一般使用localhost加不同的端口,进行访问,这样子,一台主机(域名)可以有多个网站。这个就不多说了。
简单说说配置php的xdebug,可以到Xdebug这个网站,将你的phpinfo页面源码复制进去,他会自动帮你分析,告诉你如何为php配置xdebug。
然后,在php.ini中,还有一些其他的配置,以下是我的配置,仅供参考
zend_extension = D:\php\php\php-7.1.10-nts\ext\php_xdebug-2.5.4-7.1-vc14-nts-x86_64.dll
xdebug.profiler_output_dir="D:\php\tmp\xdebug"
xdebug.trace_output_dir="D:\php\tmp\xdebug"
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.remote_enable = true
xdebug.remote_host = 127.0.0.1
xdebug.remote_port = 10000 #默认端口 9000
#其余参数
#开启自动跟踪
xdebug.auto_trace = 0
#开启异常跟踪
;xdebug.show_exception_trace = On
#开启远程调试自动启动
xdebug.remote_autostart = On
#收集变量
xdebug.collect_vars = On
#用于zend studio远程调试的应用层通信协议
xdebug.remote_handler =dbgp
#如果设得太小,函数中有递归调用自身次数太多时会报超过最大嵌套数错
xdebug.max_nesting_level = 10000
下面进入正题,phpstorm如何对于这些使用不同端口的网站应用进行调试。
进入phpstorm设置,查找Servers,如图(在配置完xdebug,必须在单网站应用可以调试使用之后,在来配置这个。不然,要是你的xdebug本来就没有配置好,你再怎么弄都没用):
接下来,看到右边的界面,其实对比一下,可以很容易的发现,你只要做的就是为不同端口网站,增加配置信息填写即可,如,我的localhost:8080
应用设置,即可。这样子就可以使phpstorm调试不同端口的应用了。