PHP Xdebug 不在 xampp 上调试

标签 php debugging xampp xdebug

当我尝试调试我的 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/

    相关文章:

    c++ - 链表程序在代码块调试器下挂起,但在其他情况下正常执行

    debugging - 如何调试 htaccess 重写脚本

    mysql - 如何在 phpMyAdmin 中禁用查询分析

    php - 如何定位 php.ini 文件 (xampp)

    php - 如果数据库查询 A 没有返回足够的结果,运行查询 B : how to optimize?

    php - Apache 缓存 JS CSS 文件

    PHP 验证 URI

    php - Laravel 5.4 邮件消息如何编辑页眉和页脚

    android - 签名 APK 中的空响应 - 调试 APK 中的正确响应

    php - 为什么 Xampp 控制面板在启动时显示错误访问被拒绝