vscode调试php进不了断点,vscode+php+xdebug won't stop at breakpoint 断点不起作用

not stopping on breakpoints

breakpoint not working

原因:

1) php.ini xdebug 端口不配置的情况下,默认是 9000,如果vscode里面改为了其他端口,php.ini里面也要改为同样的端口。

如:

a) vscode launch.json

"configurations": [

{

"name": "Listen for XDebug",

"type": "php",

"request": "launch",

"port": 9179,

"stopOnEntry":true,

"log": true

},

{

"name": "Launch currently open script",

"type": "php",

"request": "launch",

"program": "${file}",

"cwd": "${fileDirname}",

"port": 9179,

"stopOnEntry": false,

"log":true

}

php.ini 需要这么设置

[XDebug]

xdebug.profiler_append = 0

xdebug.profiler_enable = 1

xdebug.profiler_enable_trigger = 0

xdebug.profiler_output_dir ="D:\BtSoft\WebSoft\temp\xdebug\"

xdebug.trace_output_dir ="D:\BtSoft\WebSoft\temp\xdebug\"

xdebug.profiler_output_name = "cache.out.%t-%s"

xdebug.remote_enable = 1

xdebug.remote_handler = "dbgp"

xdebug.remote_host = "127.0.0.1"

xdebug.remote_autostart = 1

xdebug.remote_autorestart=1

xdebug.remote_connect_back=1

xdebug.remote_port=9179

xdebug.remote_log = "D:\BtSoft\WebSoft\temp\xdebug\debug.log"

zend_extension=php_xdebug.dll

否则断点不起作用

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
本地环境的搭建和配置是行开发工作的基础,以下是xampp、phpstorm、xdebug和chrome的配置和断点调试的步骤: 1. 安装和配置XAMPP: - 下载并安装XAMPP,它是一个集成了Apache、MySQL和PHP的开发环境。 - 打开XAMPP控制面板,启动Apache和MySQL服务。 - 在浏览器地址栏输入localhost,确认XAMPP是否正常运行。 2. 安装和配置PHPStorm: - 下载并安装PHPStorm集成开发环境。 - 打开PHPStorm,创建或导入你的项目。 - 在设置中的PHP选项中配置PHP可执行程序路径,选择XAMPP中的php.exe文件。 - 配置项目的运行/debug配置,选择Xdebug作为调试引擎。 3. 配置Xdebug: - 打开xampp\php\php.ini文件,在文件末尾添加以下代码: ``` [Xdebug] zend_extension = path_to_xampp\php\ext\php_xdebug.dll xdebug.remote_enable = 1 xdebug.remote_handler = dbgp xdebug.remote_host = localhost xdebug.remote_port = 9000 ``` 4. 配置Chrome浏览器: - 在Chrome浏览器中安装Xdebug Helper插件。 - 点击插件图标,选择设置,将IDE Key设置为PHPStorm。 - 启用Xdebug Helper插件,并确保它为绿色以表示调试已启动。 5. 调试代码: - 在PHPStorm中设置断点,可以通过点击代码行号来设置断点。 - 在Chrome浏览器中访问你的网页应用。 - 当代码运行到断点处时,PHPStorm会自动跳转到调试模式并在IDE中显示当前状态。 - 你可以使用PHPStorm的调试工具栏来控制代码的执行、查看变量的值以及观察程序的执行流程。 通过以上步骤,你可以在本地环境中使用XAMPP、PHPStorm、Xdebug和Chrome行代码的断点调试。你可以设置断点、监控变量的值,以及通过PHPStorm的调试工具栏控制代码的执行流程,这将有助于你更有效地调试和排除代码中的问题。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值