skip to Main Content

Got a problem I need to get working. I’m having difficulty getting NetBeans 12.2 to connect to Xdebug. When I try to debug I get the dreaded "Waiting For Connection (netbeans-xdebug)" which never connects. I’m running the following:

  • PHP version 8.0.2
  • Apache 2.4.46
  • Xdebug 3.0.3

I’ve read some of the other threads e.g.

but they are for older versions of Xdebug and the solutions don’t seem to work/commands are not the same. Having read the documentation and reading a solution in another threat my php.ini file has this at the end:

[xdebug]
zend_extension = C:xamppphpextphp_xdebug-3.0.3-8.0-vs16-x86_64.dll
xdebug.client_port = 9003
xdebug.remote_handler = "dbgp"
xdebug.client_host = "localhost"
xdebug.mode=debug
xdebug.start_with_request=yes

When I click debug and run netstat I can see port 9003 is listening, but for some reason this just won’t connect. I need this for work so I’m hoping someone can help a noob out? Best regards.

2

Answers


  1. I had the same problem, and these are the steps how i solved it:

    1. I reinstalled XAMPP, because I ruined my php.ini file due to configurate it too many times.

    2. Then I followed the steps from the Xdebug homepage. You can overread it fast if you don’t focus.

      2.1 Download the .dll File and place it in your "Xampp/php extension directory" (C:xamppphpext)

      2.2 Name it to: "php_xdebug.dll"

      2.3 Open the php.ini File (C:xamppphpphp.ini)

      2.4 Implement following line: "zend_extension = xdebug"
      Note: I don’t know if the order is important but for just in case put this Line under the following line: ";extension=shmop"

      2.5 Activate the step debugger with implementing following lines:
      "xdebug.mode=debug" (tells that
      "xdebug.start_with_request=default"
      Note: Here the same, put these lines under the following line: "extension=php_ftp.dll" (You can search for it, with the right editor)

    Now you are finished with the php.ini file and can start with the Netbeans configuration.

    1. The debug configuration in Netbeans (Tools > Options > PHP > Debugging):
      Netbeans configuration

    2. The project properties in Netbeans (right-click on project > properties):
      Sources
      For Source and Project Folder I entered the same directory, in this case my Project.

    3. (right-click on project > properties > Run Configuration):
      Run Configuration

    Links:
    https://xdebug.org/docs/step_debug
    https://xdebug.org/wizard

    My PHP xdebug config:
    myphpinfo() – xdebug_config
    Note: Step Debugger has to be enabled

    PS: I tested this config. with PHP-8 and xdebug-3 and as "localhost" on Windows 10. It doesn’t work for older versions!

    I hope it solves your problem, i would be happy about a feedback!

    Login or Signup to reply.
  2. There can be many reasons:

    1.Missing php ini config

    xdebug.idekey=netbeans-xdebug (or the value from netbeans settings – Session Id)

    ~ I think that form a specific version of netbeans 12.* this has been removed, but still you can give it a try

    1. try to configure the path mapping enter image description here

    Map the xamp simulated server path to the real path on your computer
    To see your server path you could try to do a var_dump($_SERVER['DOCUMENT_ROOT').
    It must be written as in linux format using ‘/’ sepparator.

    enter image description here

    3.Optional If you are debugging with chrome check if the netbeans connector addon is enabled. Try to debug also with other browsers like firefox or edge to see if there is a difference.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search