Homestead 12.1.0 + VsCode Xdebug不生效的解决办法
一、问题
Homestead使用的是 gitee.com/summerblue/homestead 的12.1.0
版本, php版本是7.4,xdebug版本是3.0.2。使用vscode的debug插件设置断点后,没有在断点处停下来,就是xdebug没有监听到请求,vscode的debug配置这样写的:
二、解决办法
折腾半天才发现homestead的xdebug配置不对,用的还是老的配置,根据xdebug更新日志 ,很多字段改了。所以我们需要修改xdebug的配置。
- 打开配置文件
#改成你实际使用的php版本,我这里是7.4 sudo vim /etc/php/7.4/fpm/conf.d/20-xdebug.ini
- 删除如下配置:
xdebug.remote_enable=1 xdebug.remote_connect_back=1 xdebug.remote_port=9000
- 加入下面的新配置
xdebug.mode=debug xdebug.start_with_request=on xdebug.discover_client_host=on xdebug.client_port=9000
- 重启fpm
sudo service php7.4-fpm restart
本作品采用《CC 协议》,转载必须注明作者和本文链接