简体   繁体   English

无法让Xdebug在Windows 7上运行

[英]Can't get Xdebug to work on Windows 7

I installed the latest XAMPP package which includes PHP 5.3.0. 我安装了最新的XAMPP软件包,其中包括PHP 5.3.0。 I am trying to enable Xdebug, but it just won't work. 我正在尝试启用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 program button, the error message will reappear in a second as if it was in an infinite loop. 如果单击“ Close the program按钮,错误消息将在一秒钟内重新出现,就好像它处于无限循环中一样。 I'd greatly appreciate any help in getting this to work. 我非常感谢在得到这个工作的任何帮助。

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

It's possible you have the wrong version of Xdebug. 你可能有错误版本的Xdebug。 I would take a look at phpinfo() and compare the information there to the different versions of the Xdebug dll . 我将看看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)。

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. Windows二进制文件通常适用于上述PHP版本的每个迷你版本,尽管该扩展是针对当时最新的PHP版本构建的。 The VCx marker tells with which compiler the extension was built, and Non-thread-safe whether ZTS was disabled. VCx标记告诉构建扩展的编译器,以及是否禁用ZTS的非线程安全。 Those qualifiers need to match the PHP version you're using. 这些限定符需要匹配您正在使用的PHP版本。 If you don't know which one you need, please refer to the custom installation instructions. 如果您不知道需要哪一个,请参阅自定义安装说明。

http://xdebug.org/wizard.php http://xdebug.org/wizard.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

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: 坦率地说,我还有两个非常糟糕的日子,我现在还没有最终修复它,所以这里是我的Do和陷阱的集合:

; 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. 我在网上看过几次xdebug.remote_handle(没有r)的拼写错误。 beware. 谨防。

A note on the idekey: The above idekey did show in phpinfo() as master value, BUT was overridden with a 'local value' like MYMACHINENAME$. 关于idekey的注释:上面的idekey确实在phpinfo()中显示为主值,但是被覆盖了像MYMACHINENAME $这样的“本地值”。 ==> Setting a global env var (in computer properties) named DBGP_IDEKEY and rebooting (or maybe just logging out) to (also) netbeans-xdebug helps! ==>设置一个名为DBGP_IDEKEY的全局env var(在计算机属性中)并重启(或者可能只是注销)到(也)netbeans-xdebug有帮助! Again: re-check in phpInfo() it took effect. 再次:重新检查phpInfo()它生效了。

Of course adjust netbeans-menu:options->php tab->debugging section to this port and session id. 当然调整netbeans-menu:options-> php tab-> debugging section to this port和session id。

Here is a script, to check (by php means) if that port you intend to talk to is open. 是一个脚本,用于检查(通过php方式)您打算与之交谈的端口是否已打开。 (further below also in the comments, for those to lazy too type from the image) (进一步下面也在评论中,对于那些从图像中来说太懒的人)

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 tool might help. 端口边界上此工具也可能有所帮助。

Quadruplecheck you are keeping VC6 and VC9 compiled versions of everything apart. Quadruplecheck你保持VC6和VC9编译版本的一切。

Running your whatever/path/php.exe myTest.php from 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运行你的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包更适合我......)

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 bug reported with many users complaining about it. 许多用户抱怨它有一个错误报告。

The solution seems to be latest beta version on Xampp . 该解决方案似乎是Xampp上的最新测试版 It includes version 2.0.6 (dev) of xdebug and it is working just fine. 它包括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天,但没有遇到任何问题。

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. 如果您还没有弄清楚(这是一个旧线程), 那么您缺少的是INI配置。 If you are loading a module that's thread safe, you need to use the following line: 如果要加载一个线程安全的模块,则需要使用以下行:

zend_extension="C:\Path\To\The\Extension.dll"

If the module is not thread 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而不是常规扩展。

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.ini you need to specify the full path to x86 folder of Program Files like. 当xdebug没有安装XAMPP时,只需使用PHP(32位,TS,VC6,在C:\\ Program Files(x86)\\ PHP)和Windows 7(64位)上的Apache(32位),在php.ini中,您需要指定程序文件的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. 这是我的错,当改为x86文件夹时,xdebug开始完美运行。 Hope this help you, too. 希望这对你有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM