Skip to content

Instantly share code, notes, and snippets.

@oleksis
Created March 8, 2022 18:25
Show Gist options
  • Save oleksis/acf28be2c03ca0595a86e0a03a7555b2 to your computer and use it in GitHub Desktop.
Save oleksis/acf28be2c03ca0595a86e0a03a7555b2 to your computer and use it in GitHub Desktop.
Installing Xdebug for XAMPP

Installing Xdebug for XAMPP

XDebug Setup for PHP 8

Download XDebug

Installation using the Wizard.

Copy the PHP info using Powershell

 php -i | clip

PHP.INI

Disable output buffering

output_buffering = Off

XDebug section

[XDebug]
zend_extension = xdebug
;zend_extension = "c:\xampp\php\ext\php_xdebug-2.9.7-7.4-vc15-x86_64.dll"
xdebug.mode = develop,debug
xdebug.start_with_request = yes
xdebug.log = "c:\xampp\tmp\xdebug.log"
xdebug.remote_autostart = 1
xdebug.profiler_append = 0
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir = "c:\xampp\tmp"
;xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "dbsxrx.com"
xdebug.remote_log = "c:\xampp\tmp\xdebug.log"
xdebug.remote_port = 9003
xdebug.trace_output_dir = "c:\xampp\tmp"
;36000 = 10h
xdebug.remote_cookie_expire_time = 36000

Visual Studio Code

  • launch.json
{
    // 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
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9003,
            "runtimeArgs": [
                "-dxdebug.start_with_request=yes"
            ],
            "env": {
                "XDEBUG_MODE": "debug,develop",
                "XDEBUG_CONFIG": "client_port=${port}"
            }
        },
        {
            "name": "Launch Built-in web server",
            "type": "php",
            "request": "launch",
            "runtimeArgs": [
                "-dxdebug.mode=debug",
                "-dxdebug.start_with_request=yes",
                "-S",
                "localhost:0"
            ],
            "program": "",
            "cwd": "${workspaceRoot}",
            "port": 9003,
            "serverReadyAction": {
                "pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
                "uriFormat": "http://localhost:%s",
                "action": "openExternally"
            }
        }
    ]
}
  • settings.json
{
    "workbench.colorTheme": "GitHub Dark Default",
    "editor.fontFamily": "'FiraCode Nerd Font',Consolas, 'Courier New', monospace",
    "git.autofetch": true,
    "[javascript]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "diffEditor.ignoreTrimWhitespace": false,
    "php.validate.executablePath": "C:\\xampp\\php\\php.exe",
    "php.debug.executablePath": "C:\\xampp\\php\\php.exe",
}

Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment