使用的phpstudy,自己配置也是一样的
开启xdebug拓展
如果是手动安装,需要去官网下载xdebug.dll,并放在ext文件夹里
修改PHP配置文件
手动党就找到 php安装目录/php.ini
直接拉到文件最后,或者搜索[Xdebug] ,修改这2个,有就改,没有就加
xdebug.remote_autostart=1
xdebug.remote_enable=1
完整演示
端口号是9000,你可以自己改,记一下,后面要用
[Xdebug]
zend_extension=D:/php/phpstudy/Extensions/php/php7.4.3nts/ext/php_xdebug.dll
xdebug.collect_params=1
xdebug.collect_return=1
xdebug.auto_trace=Off
xdebug.trace_output_dir=D:/php/phpstudy/Extensions/php_log/php7.4.3nts.xdebug.trace
xdebug.profiler_enable=Off
xdebug.profiler_output_dir=D:/php/phpstudy/Extensions/php_log/php7.4.3nts.xdebug.profiler
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
VScode 插件配置
安装这俩PHP Debug和PHP Intelephense
然后点击Debug的小齿轮 – 选择扩展设置
选择在setting.json中编辑
修改配置,后面改成你的php安装路径(有就改,没有就加)
"php.validate.executablePath":"D:\\php\\phpstudy\\Extensions\\php\\php7.4.3nts\\php.exe", // 验证
"php.executablePath":"D:\\php\\phpstudy\\Extensions\\php\\php7.4.3nts\\php.exe", // 运行时解释器指向
"php.debug.executablePath": "D:\\php\\phpstudy\\Extensions\\php\\php7.4.3nts\\php.exe", // 调试
调试设置
单击调试文件配置launch.json,会自动创建一个文件,并且一堆话
修改端口号即可,就是php.ini里x-debug设置里的端口号
重启apache
字面意思
测试文件
完成!