介绍
Xdebug是php的调试插件,一般需要自行配置扩展。原理是 在请求时,通过TCP协议发送调试信息到远程端口,IDE在收到调试信息时,可以向Xdebug发送运行,单步运行,中止运行等命令。
前提条件
- 搭建好的web环境,集成环境什么的,随意挑选
- 下载好了PhpStorm,附上官网
- php对应版本的Xdebug扩展
- 一般php7以上的版本,已下载安装了该扩展
- 没有的话去官网下载个对应操作系统和php版本的,然后将该文件重命名为
php_xdebug.dll
,把该文件复制到php的ext文件夹下
php.ini配置
打开当前环境使用的php.ini配置文件,在自己认为合适的位置添加以下代码:(有就打开注释)
[xdebug]
zend_extension ="D:/php/php7.3.4nts/ext/php_xdebug.dll"
xdebug.remote_enable = 1
;远程主机
xdebug.remote_host = 127.0.0.1
;主机端口
xdebug.remote_port = 9001
;开启自动开始调试
xdebug.remote_autostart=on
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_out