在pecl官网搜索xdebug,然后根据你的电脑上的php版本选择dll下载。不知道php版本的可以 php -v 命令看下。
php -v
可以看到我的是 7.1.13 NTS x86 版本的
https://pecl.php.net/package/xdebug
点击这个dll可以看到不同php版本的dll文件。
经过与我的php版本比较,我就需要下载这款。
下载好的dll文件放到php安装目录下的ext目录下面去。
在php.ini中进行如下配置,注意zend_extension ,xdebug.profiler_output_dir,xdebug.trace_output_dir位置根据你的php安装位置改下:
[XDebug]
zend_extension = "D:\xampp\php\ext\php_xdebug.dll";调试扩展dll
;xdebug.profiler_append = 0
;xdebug.profiler_enable = 1
;xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "D:\xampp\tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1";远程调试主机ip
xdebug.trace_output_dir = "D:\xampp\tmp"
xdebug.remote_port=19000;远程调试端口
;xdebug.remote_autostart=Off
配置好后执行 php -m 查看xdebug是不是成功加载了,如果没有的话,下载低一个版本的xdebug再试下,如此类推,总有合适的。
在phpstorm里面配置xdebug监听端口为19000,fast_cgi用了9000端口,我们就用19000.
file->setting->Languages & Frameworks->PHP->Debug到如下界面进行配置
点击右上位置 Add Configuration配置项目,配置好就可以点那个调试按钮进行断点调试了(注意这里的start url一定要能访问到php文件哦,你如果是入口文件是index.html的话,需要建个index.php加在start url后面)