Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  • 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
like image 629
Ves04 Avatar asked Mar 29 '26 21:03

Ves04


1 Answers

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

like image 134
yacsha Avatar answered Apr 02 '26 11:04

yacsha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!