0

These are the features of my components:

  • XAMPP 3.2.4
  • PHP: 7.4.25
  • NetBeans: 12.0
  • Apache: Apache/2.4.51 (Win64) OpenSSL/1.1.1l PHP/7.4.25

This is the final part of my php.ini file:

[xDebug]
zend_extension = "c:\xampp\php\ext\php_xdebug-3.1.1-7.4-vc15-x86_64.dll"
xdebug.remote_autostart=on
xdebug.remote_enable=on
xdebug.remote_enable=1
xdebug.remote_handler="dbgp"
;xdebug.remote_host="localhost:81"
xdebug.remote_host=localhost:8888
;xdebug.remote_connect_back=1
xdebug.remote_port=9000
xdebug.remote_mode=req
xdebug.idekey="netbeans-xdebug"

When I run phpinfo(), Xdebug installed, and when I debug a project from NetBeans, it says

Waiting For Connection (netbeans-xdebug)

Can someone help me to configure it? Would be very appreciated.

LazyOne
  • 158,824
  • 45
  • 388
  • 391
  • 1
    Does this answer your question? [Debug not working in PhpStorm with server on VM](https://stackoverflow.com/questions/69836787/debug-not-working-in-phpstorm-with-server-on-vm) – Derick Nov 08 '21 at 09:00
  • Does this answer your question? [netbeans shows "Waiting For Connection (netbeans-xdebug)"](https://stackoverflow.com/questions/17613726/netbeans-shows-waiting-for-connection-netbeans-xdebug) – bitski Nov 08 '21 at 23:19
  • I am try this solution already but netbeans show this message – Muhammad Ali Nov 10 '21 at 06:45

1 Answers1

0

Your settings are those of xdebug v2, but it looks like you are using xdebug v3.

As mentioned by Derick in the comments there is an upgrade guide.

Still in my experience I mainly understand these manuals after I have got some configuration to work, because this not only depends on xdebug, but also on the configuration of the IDE and on how you map your server folders to your local project folders. So let me show two working configurations, one with netbeans and one with vscode.

My setup is as follows:
my projectdir is mapped to the server as follows:

local: /`projectdir`/site/public
to server: /var/www/site/public (This is DocumentRoot in the apache configuration file)
index.php is located in /`projectdir`/site/public

Replace projectdir with your projectdir.
On windows replace forward slashes with backslashes.
Use the right path for the zend_extension for your configuration.

  1. configuration with netbeans php.ini:

         zend_extension=xdebug.so
         xdebug.mode = debug
         xdebug.discover_client_host = true
         xdebug.idekey="netbeans-xdebug"
     

The debug configuration in netbeans (Tools > Options > PHP > Debugging):

    Debugger Port: 9003
    Session ID: netbeans-xdebug
    (and maybe check Stop at First Line)

The project properties in netbeans(right-click on project > properties):

Sources: Project Folder: <project>
         Source Folder: <project>
         Web Root: site/public

Run Configuration: Project URL: <URL> (or hostname)
                   Index File: index.php

The default port of xdebug has changed to 9003; You can set it to 9000 with xdebug.client_port in php.ini. xdebug.discover_client_host will try to connect to your IDE. If this does not work you could try to set the ip addres of the client with xdebug.client_host wich replaces xdebug.remote_host from version 2. Obviously xdebug.idekey must correspond with the Session ID of your netbeans configuration.

  1. configuration with vscode php.ini:

         zend_extension=xdebug.so
         xdebug.mode = debug
         xdebug.start_with_request = yes
         xdebug.discover_client_host = true
     

.vscode/launch.json (menu: Run > Add Configuration...)

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for XDebug 3",
            "type": "php",
            "request": "launch",
            "stopOnEntry": true,
            "pathMappings": {
                "/var/www": "${workspaceRoot}",
            },
            "port": 9003
        },
        {
            "name": "Listen for XDebug 2",
            "type": "php",
            "request": "launch",
            "stopOnEntry": true,
            "pathMappings": {
                "/var/www": "${workspaceRoot}",
            },
            "port": 9000
        }
    ]
}
eniel
  • 36
  • 5