当我尝试调试我的 php 代码时,出现错误:
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'
]
}
我遵循了 xdebug 向导指令,但它仍然无法正常工作:
php_xdebug-2.9.1-7.3-vc15-x86_64.dll
C:\xampp\php\ext
C:\xampp\php\php.ini
C:\WINDOWS\php.ini
并添加行zend_extension =
C:\xampp\php\ext\php_xdebug-2.9.1-7.3-vc15-x86_64.dll
zend_extension =
C:\xampp\php\ext\php_xdebug-2.9.1-7.3-vc15-x86_64.dll
低于OPcache 行。
最佳答案
我有同样的错误消息,但使用 xdebug 3.0.1,结果证明设置 xdebug 的传统方法已经改变。目前启动xdebug3如下:
VS 代码 (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
您可以在此链接中找到更多信息:https://github.com/felixfbecker/vscode-php-debug/issues/411
关于PHP Xdebug 不在 xampp 上调试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60045255/