如何使用WAMP配置xdebug

问题描述 投票:0回答:5

我正在使用 wamp 2.0 并尝试安装 php 的 XDebug 扩展。我已遵循此处编写的所有步骤http://wiki.netbeans.org/HowToConfigureXDebug#How_to_configure_xdebug_with_WAMP 但它仍然不起作用。

有什么建议如何解决这个问题吗?

wamp xdebug
5个回答
55
投票

请按照 http://xdebug.org/find-binary.php

的说明进行操作

干杯, 德里克


11
投票

如果您只是使用 xdebug 使用 wampserver 3.0.6 和 php 7.0.10 调试本地会话,则几乎无需手动编辑 php.ini(稍后会详细介绍)。

您可以从托盘图标菜单激活xdebug.remote_enable。完成此操作后,应该会在 php.ini 中产生类似以下输出(位于文件的绝对末尾):

; XDEBUG Extension
[xdebug]
zend_extension ="C:/wamp64/bin/php/php7.0.10/zend_ext/php_xdebug-2.4.1-7.0-vc14-x86_64.dll"
xdebug.remote_enable = On
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir ="C:/wamp64/tmp"
xdebug.show_local_vars=0

从那里开始,您唯一需要自己专门添加(至少在 VS Code 中使用 php-debug 扩展时)到 php.ini 的是:

xdebug.remote_autostart = 1

之后不要忘记重新启动 wampserver。 如果您需要远程连接到另一台主机,您可能需要一些变体(将 127.0.0.1 替换为远程 IP):

xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000

但这几乎超出了我的回答范围,因为这打开了一个全新的蠕虫罐,恕我直言


5
投票

按照 Derick 提到的 http://xdebug.org/find-binary.php 上的说明进行操作,但是在 Wampserver 3.0.0 上配置 xdebug 时,我还必须将以下代码添加到我的 php.ini 中。

xdebug.remote_enable=true
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.profiler_enable=0
xdebug.profiler_output_dir = C:\wamp\tmp

2
投票

对于 php 7,配置变量被重命名为我最终的工作配置,结果如下:

   xdebug.mode = develop,debug,profile
   xdebug.start_with_request=yes
   xdebug.output_dir =c:/wamp64/tmp
   xdebug.show_local_vars = 1
   xdebug.log=c:/wamp64/logs/xdebug.log
   xdebug.log_level = 10
   xdebug.client_host=localhost
   xdebug.client_port=9000

0
投票

我正在使用 wamp 服务器 3.3。那里已经安装了调试器。我们需要做一些小事情来配置它。
第1步:

安装x调试 帮手 浏览器扩展

第 2 步:- apache模块your-php-version-FCGI-CLI文件中打开php.ini文件。您可以从php部分中的wamp托盘访问这两个文件
那里已经有 [xdebug] 行。在 **both** 文件中的

[xdebug]
下添加以下行并保存。无需添加除以下之外的任何其他行

xdebug.mode=开发,调试
xdebug.remote_autostart=1
xdebug.start_with_request=yes

第 3 步:- 在 VS Code 中安装 php 调试器扩展。在调试器部分收听 xdebugger。在 xdebugger 3 中默认端口是 9003

© www.soinside.com 2019 - 2024. All rights reserved.