wsl for window环境通过vscode工具debug php的laravel框架项目

背景

php:7.2
宿主机环境:wsl for window
开发工具:vscode

步骤1:通过phpstudy配置php、xdebug

命令窗口执行
wget -O install.sh https://notdocker.xp.cn/install.sh && sudo bash install.sh
执行结束,自动给出地址,账户密码等信息,安装下图信息安装php、给安装的php配置xdebug

步骤2:通过phpstudy配置php.ini的xdebug环境

xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_port = 9000

步骤3:vscode配置环境

先下载php debug插件

配置vscode launch.json

{ "configurations": [ { "name": "Launch current script in console", "type": "php", "request": "launch", "program": "${file}", "cwd": "${fileDirname}", "externalConsole": false, "port": 9001 }, { "name": "Listen for XDebug", "type": "php", "request": "launch", "port": 9001 } ] }

在.env中添加两个代码
XDEBUG_MODE=debug
XDEBUG_SESSION=vscode

步骤4:开始debug

先点击debug

再脚本启动:
php artisan serve --env production
此时debug效果就有了

posted @   王吉平  阅读(218)  评论(1编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
点击右上角即可分享
微信分享提示