Can't get Xdebug to work on Windows 7

13,365

Solution 1

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.

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).

Solution 2

Have you tried custom installation wizard of XDEBUG, it analyses your php installation and provides exact steps you need to follow

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.

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

Solution 3

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:

; 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)

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.

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.

Of course adjust netbeans-menu:options->php tab->debugging section to this port and session id.

Here is 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)

For your browser to connect, don't start to forget (amidst frustration) to always attach the debug-starting 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.

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).

I can recommend http://www.wampserver.com (for personal reasons it fits me better than the popular xampp package...)

Share:
13,365

Related videos on Youtube

Derek
Author by

Derek

Updated on April 16, 2022

Comments

  • Derek
    Derek about 2 years

    I installed the latest XAMPP package which includes PHP 5.3.0. I am trying to enable Xdebug, but it just won't work.

    Here's what I changed in the php.ini shipped with XAMPP:

    ; 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:

    alt text

    If I click the Close the program button, the error message will reappear in a second as if it was in an infinite loop. I'd greatly appreciate any help in getting this to work.

    I am running a fresh install of Windows 7 Ultimate 64-bit.

    EDIT: From the result of phpinfo():

    Zend Extension Build    API220090626,TS,VC6 
    PHP Extension Build     API20090626,TS,VC6 
    Debug Build             no 
    Thread Safety           enabled
    
  • Derek
    Derek over 14 years
    Thread safety is enabled. PHP is complied with VC6. I grabbed thread-safe 5.3 VC6 and neither the 32-bit flavor nor the 64-bit flavor is loaded. However, Apache doesn't crash anymore.
  • Frank Nocke
    Frank Nocke over 12 years
    Note: Using a ts is NOT correct for Apache 2.2.21, PHP 5.3 under W7 x64, even if PHP and Apoache is TS, use the normal key (just assign the correct dll to it, the one, that does not bear an _nts in it). Maybe it was correct some time back.
  • dcousineau
    dcousineau over 12 years
    You are correct, doubt anyone will ever see my post at this point but I updated it
  • hila shmueli
    hila shmueli about 11 years
    This is helpful, I had php 5.4 but was trying to install 5.3 dll which did not give an error though.
  • Josh
    Josh over 9 years
    The wizard saved me, nothing else I tried worked. Ended up being absolute vs. relative path.