Skip to content

Instantly share code, notes, and snippets.

@antoine1003
Last active August 13, 2020 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antoine1003/5fea4b8401373d30b0855286a8ab51c2 to your computer and use it in GitHub Desktop.
Save antoine1003/5fea4b8401373d30b0855286a8ab51c2 to your computer and use it in GitHub Desktop.
How to install XDebug on VSCODE

Install XDegug Extension

Install XDebug extension on VSCode available here

Create a lauch.json

In the root of your project create a .vscode folder and inside create a lauch.json. Put this code inside :

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9001
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9001
        }
    ]
}

Download xdebug.dll

Find you php version php -v and download the xdebug associated to your php version here Mode the .dll file to php-path/ext.

I like to rename my file to php_xdebug.dll (php_xdebug-2.9.6-7.4-vc15-nts-x86_64.dll => php_xdebug.dll)

Configure php.ini

I like to rename

Find the path of your php.ini with php --ini command.

Open your file and go to the bottom and add (if not already) :

[xdebug]
zend_extension="php-path/ext/php_xdebug.dll"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_port=9001
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = Off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir ="C:/xampp/tmp" # Modify it to you own need
xdebug.show_local_vars=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment