3

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:

  • Download php_xdebug-2.9.1-7.3-vc15-x86_64.dll
  • Move the downloaded file to C:\xampp\php\ext
  • Edit C:\xampp\php\php.ini C:\WINDOWS\php.ini and add the line zend_extension = C:\xampp\php\ext\php_xdebug-2.9.1-7.3-vc15-x86_64.dll
  • Make sure that zend_extension = C:\xampp\php\ext\php_xdebug-2.9.1-7.3-vc15-x86_64.dll is below the line for OPcache.
  • Restart the webserver
1
  • 1
    "Edit C:\xampp\php\php.ini C:\WINDOWS\php.ini" — the wizard should give you one file, not two. Were there really 2? Also, does Xdebug show up in your normal phpinfo() output? Is PHP on the path? The error that you get from VSCode indicates that it is not. Commented Feb 3, 2020 at 20:33

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.