一、设置apache启用Xdebug
下载wamp Server,一般自带Xdebug;如果没有Xdebug可在https://xdebug.org下载,放到ext目录下,然后设置php.ini文件,在最后加上:
例:
[xdebug]
zend_extension ="d:/wamp64/bin/php/php5.6.16/ext/php_xdebug-2.4.0rc2-5.6-vc11-x86_64.dll"
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 1
xdebug.remote_enable =1
xdebug.remote_handler = dbgp
xdebug.remote_host = localhost
xdebug.remote_mode = req
xdebug.remote_port = 9000
xdebug.idekey=phpStorm
然后重启apache。
二、设置PhpStorm
1、File->Settings->Languages & Frameworks->PHP
2、File->Settings->Languages & Frameworks->PHP->Servers
3、File->Settings->Languages & Frameworks->PHP->Debug
注意:Debug port要和php.ini设置的相同
4、File->Settings->Languages & Frameworks->PHP->Debug->DBGp Proxy
注意:IDE key要和php.ini设置的相同
5、进行Debug配置:
6、新建一PHP Web Application,内容如下:
7、点击右上角小电话,开启PHP Debug Connections
8、最后,开启Debug调试
效果如下: