Laragon 设置 Windows 下 PHP 开发环境

https://laragon.org/download/
https://laragon.org/docs/

设置 xdebug

[Xdebug]
zend_extension="C:\laragon\bin\php\php-8.4.2-nts-Win32-vs17-x64\ext\php_xdebug.dll"
xdebug.mode=debug,trace,profile
xdebug.start_with_request=trigger
xdebug.client_host="localhost"
xdebug.client_port=9003
xdebug.log="D:\xdebug.log" 

启用了调试(debug)、函数调用追踪(trace)和性能分析(profile)模式,并设置了在触发条件下启动调试(trigger)。这种配置可以满足多种调试需求。

然后安装 chrome 的 xdebug 插件来启动 debug 模式,启动前一定先在 vscode 调试器中启动调试。不然 xdebug 连不上你的 client_host 和 client_port,然后卡死。

如果修改了 php.ini 配置,需要重启 php-cgi.exe 进程,这里点 Laragon 面板里的 nginx Reload,它会重新启动一组 php-cgin.exe 进程。

设置 vscode 的 php 调试

安装 vscode 的 PHP Debug 插件后,直接到调试界面启动调试。

实际使用,你可以一直在 vscode 中启动调试,让其一直监听 0.0.0.0:9003,然后通过浏览器的 xdebug 插件来控制是否调试。

通过 error_log 输出调试

error_log 的路径需要在 php.ini 中配置。

error_log = "C:/laragon/tmp/php_errors.log"

然后在 wordpress 代码中

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);

error_log("这是我的调试信息");

// Define a variable to debug
$my_variable = 'Hello, Query Monitor!';

// Use error_log to print the variable
error_log('My Debug Plugin: ' . print_r($my_variable, true));
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇