apache 无法让 Xdebug 在 Windows 7 上工作
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1904138/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can't get Xdebug to work on Windows 7
提问by Derek
I installed the latest XAMPP package which includes PHP 5.3.0. I am trying to enable Xdebug, but it just won't work.
我安装了最新的 XAMPP 包,其中包括 PHP 5.3.0。我正在尝试启用 Xdebug,但它不起作用。
Here's what I changed in the php.ini shipped with XAMPP:
这是我在 XAMPP 附带的 php.ini 中更改的内容:
; uncommented
zend_extension = "X:\xampp\php\ext\php_xdebug.dll"
; added the following lines:
xdebug.remote_enable=true
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
Apache starts fine, but when I open http://localhost/in my browser, I get the following error:
Apache 启动正常,但是当我http://localhost/在浏览器中打开时,出现以下错误:


If I click the Close the programbutton, the error message will reappear in a second as if it was in an infinite loop. I'd greatly appreciate anyhelp in getting this to work.
如果我单击该Close the program按钮,错误消息将在一秒钟内重新出现,就好像它处于无限循环中一样。我将不胜感激任何帮助使其正常工作。
I am running a fresh install of Windows 7 Ultimate 64-bit.
我正在运行全新安装的 Windows 7 Ultimate 64 位。
EDIT: From the result of phpinfo():
编辑:来自 phpinfo() 的结果:
Zend Extension Build API220090626,TS,VC6
PHP Extension Build API20090626,TS,VC6
Debug Build no
Thread Safety enabled
回答by zombat
It's possible you have the wrong version of Xdebug. I would take a look at phpinfo()and compare the information there to the different versions of the Xdebug dll.
您可能使用了错误版本的 Xdebug。我会看看phpinfo()并将那里的信息与 Xdebug dll的不同版本进行比较。
Specifically, you want to see if "Thread Safety" is enabled, and you need to know whether you're running a VC6-compiled PHP or a VC9 (if you're using Apache, it's almost guaranteed that you want the VC6).
具体来说,您想查看是否启用了“线程安全”,并且您需要知道您运行的是 VC6 编译的 PHP 还是 VC9(如果您使用的是 Apache,几乎可以保证您需要 VC6)。
回答by Basav
Have you tried custom installation wizard of XDEBUG, it analyses your php installation and provides exact steps you need to follow
您是否尝试过 XDEBUG 的自定义安装向导,它会分析您的 php 安装并提供您需要遵循的确切步骤
The Windows binaries generally work for every mini release for the mentioned PHP version, although the extension is built against the most current PHP version at that time. The VCx marker tells with which compiler the extension was built, and Non-thread-safe whether ZTS was disabled. Those qualifiers need to match the PHP version you're using. If you don't know which one you need, please refer to the custom installation instructions.
Windows 二进制文件通常适用于上述 PHP 版本的每个迷你版本,尽管该扩展是针对当时最新的 PHP 版本构建的。VCx 标记表明扩展是用哪个编译器构建的,以及非线程安全的 ZTS 是否被禁用。这些限定符需要与您使用的 PHP 版本相匹配。如果您不知道需要哪一种,请参阅自定义安装说明。
Just paste your phpinfo out put in the text box and you will get exact xdebug dll you would need for your php
只需将您的 phpinfo 粘贴到文本框中,您将获得您的 php 所需的确切 xdebug dll
回答by Frank Nocke
frank-ly, I also had 2 REALLY bad days, and I don't now what finally fixed it, so here's my collection of Do's and pitfalls:
坦率地说,我也有 2 个非常糟糕的日子,我现在不知道最终修复它的是什么,所以这是我的做和陷阱的集合:
; this is the thread safe version,
; the absence of _nts_ in the dll name 'shows' this
; do not use _ts, your library won't get registered and won't show in phpInfo()
zend_extension = "D:/wamp/bin/php/php5.3.8/zend_ext/php_xdebug-2.1.2-5.3-vc9-x86_64.dll"
check your php.ini, check phpinfo() if all values (arrive)
检查您的 php.ini,检查 phpinfo() 如果所有值(到达)
xdebug.remote_enable = on
xdebug.remote_handler=dbgp
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
; if you have multiple virtual hosts ( like 'local.fooclient' )
; maybe using the IP is safer (for any same-machine-debugging)
xdebug.remote_host=127.0.0.1
; maybe a -much- lower port helped, 84 was free. use netstat to figure out.
xdebug.remote_port=84
; idekey! also see note below
xdebug.idekey=netbeans-xdebug
More Pitfalls:
更多陷阱:
I have seen a typo of xdebug.remote_handle (without r) several times on the web. beware.
我在网上多次看到 xdebug.remote_handle(没有 r)的拼写错误。谨防。
A note on the idekey: The above idekey did show in phpinfo() as master value, BUT was overridden with a 'local value' like MYMACHINENAME$. ==> Setting a global env var (in computer properties) named DBGP_IDEKEY and rebooting (or maybe just logging out) to (also) netbeans-xdebug helps! Again: re-check in phpInfo() it took effect.
关于 idekey 的注释:上述 idekey 确实在 phpinfo() 中显示为主值,但被“本地值”覆盖,如 MYMACHINENAME$。==> 设置一个名为 DBGP_IDEKEY 的全局环境变量(在计算机属性中)并重新启动(或者可能只是注销)到(也)netbeans-xdebug 有帮助!再次:重新检查 phpInfo() 生效。
Of course adjust netbeans-menu:options->php tab->debugging section to this port and session id.
当然调整 netbeans-menu:options->php tab->debugging 部分到这个端口和会话 id。
Hereis a script, to check (by php means) if that port you intend to talk to is open. (further below also in the comments, for those to lazy too type from the image)
这是一个脚本,用于检查(通过 php 方式)您打算与之通信的端口是否已打开。(下面也在评论中,对于那些懒得从图像中输入的人)
For your browser to connect, don't start to forget (amidst frustration) to always attach the debug-starting get-argument:
为了您的浏览器连接,不要开始忘记(在沮丧中)始终附加调试开始的 get-argument:
http://localhost/myTest.php?XDEBUG_SESSION_START=netbeans-xdebug
On the port frontier, also this toolmight help.
在港口边境,这个工具也可能有所帮助。
Quadruplecheck you are keeping VC6 and VC9 compiled versions of everything apart.
Quadruplecheck 您将所有内容的 VC6 和 VC9 编译版本分开。
Running your whatever/path/php.exe myTest.phpfrom the command line (once the above settings are done) might also reveal additional errors (it did, while I was tinkering with an incorrect dll).
运行你的whatever/path/php.exe myTest.php命令行(一旦上述设置完成),也可能会显示其他错误(也如此,而我是用了不正确的DLL修修补补)。
I can recommend http://www.wampserver.com(for personal reasons it fits me better than the popular xampp package...)
我可以推荐http://www.wampserver.com(出于个人原因,它比流行的 xampp 包更适合我......)
回答by Vafliik
Yes, there is a known problem - is almost impossible to get Xdebug working with latest Xampp and 64-bit Vista/Win 7.
是的,有一个已知问题 - 几乎不可能让 Xdebug 与最新的 Xampp 和 64 位 Vista/Win 7 一起工作。
There is a bugreported with many users complaining about it.
有一个错误报告,许多用户抱怨它。
The solution seems to be latest beta version on Xampp. It includes version 2.0.6 (dev) of xdebug and it is working just fine.
该解决方案似乎是Xampp 上的最新测试版。它包括 xdebug 的 2.0.6 (dev) 版本,并且运行良好。
I tested it on 64-bit Vista for approx 10 days and not encountered any problem yet.
我在 64 位 Vista 上测试了大约 10 天,但还没有遇到任何问题。
回答by dcousineau
Like others have said, you need to match your xdebug version with your php version.
就像其他人所说的那样,您需要将您的 xdebug 版本与您的 php 版本相匹配。
You've already matched up PHP version number, thread safety, and compiler.
您已经匹配了 PHP 版本号、线程安全性和编译器。
If you haven't already figured it out (this is an old thread), what you're missing is the INI configuration.If you are loading a module that's thread safe, you need to use the following line:
如果您还没有弄清楚(这是一个旧线程),那么您缺少的是 INI 配置。如果要加载线程安全的模块,则需要使用以下行:
zend_extension="C:\Path\To\The\Extension.dll"
If the module is notthread safe, then you use the INI directive you've been trying to use.
如果模块不是线程安全的,那么您可以使用您一直在尝试使用的 INI 指令。
This only applies to zend_extension's and not regular extensions.
这仅适用于 zend_extension 而非常规扩展。
回答by Eye
When xdebug is installed not with XAMPP, just with PHP (32bit, TS, VC6, in C:\Program Files (x86)\PHP) and Apache (32bit) on Windows 7 (64bit), in php.iniyou need to specify the full path to x86folder of Program Files like.
当 xdebug 不使用 XAMPP 安装时,只使用 PHP(32 位、TS、VC6,在 C:\Program Files (x86)\PHP)和 Windows 7(64 位)上的 Apache(32 位),在php.ini 中你需要指定Program Files 等x86文件夹的完整路径。
zend_extension="C:\Program Files (x86)\PHP\ext\php_xdebug-2.1.1-5.3-vc6.dll"
and NOT
而不是
zend_extension="C:\Program Files\PHP\ext\php_xdebug-2.1.1-5.3-vc6.dll"
This was my mistake, when changed to x86 folder, xdebug started to work perfectly. Hope this help you, too.
这是我的错误,当更改为 x86 文件夹时,xdebug 开始完美运行。希望这对你也有帮助。

