Ves04
Ves04

Reputation: 71

PHP Xdebug doesn't debug on xampp

When I try to debug my php code I get the error:

Error: spawn php ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:9) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn php',
  path: 'php',
  spawnargs: [
    'c:\\xampp\\htdocs\\fantatools\\wordpress\\wp-content\\themes\\feisar\\api\\calendario.php'
  ]
}

I followed the xdebug wizard instruction but it's still not working:

Upvotes: 3

Views: 4731

Answers (1)

yacsha
yacsha

Reputation: 71

I had the same error message, but with xdebug 3.0.1, and it turns out that the traditional method for setting the xdebug has changed. Currently starting xdebug3 is as follows:

VS Code (launch.js)

  {
        // 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",
                "type": "php",
                "request": "launch",
                "port": 9003,
                "pathMappings": {
                    "your filepath": "${workspaceRoot}",
                }
            }
        ]
    }

PHP INI

[xdebug]
zend_extension="your xdebug library"
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.discover_client_host = true

You will find more information at this link: https://github.com/felixfbecker/vscode-php-debug/issues/411

Upvotes: 1

Related Questions