Jump to content

How to use XDebug with Laragon + VSCode


Recommended Posts

I love TracyDebugger, but today I had a hard time debugging some stuff and tried XDebug to get support for breakpoints. It was a quite straightforward setup:

  • create a file on your server and output phpinfo()
  • Copy the content of this page to the wizard: https://xdebug.org/wizard.php
  • DON'T follow the instructions there, it's simpler with laragon (choose your files and paths of course):
Download php_xdebug-2.6.0-7.1-vc14-x86_64.dll
Move the downloaded file to C:\laragon\bin\php\php-7.1.14-Win32-VC14-x64\ext
Enable xdebug via laragon


  • check if everything worked by visiting the phpinfo() page again - it should show a section about xdebug now
  • enable validaton in vscode by adjusting the user settings:
  "php.validate.enable": true,
  "php.validate.executablePath": "C:/laragon/bin/php/php-7.1.14-Win32-VC14-x64/php.exe",
  "php.validate.run": "onType",
  • install "PHP Debug" extension by Felix Becker and read the instructions
  • enable remote debugging by xdebug by adding this to your php.ini
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
  • create a testfile, eg home.php and set the debug config to "PHP"


  • add breakpoints and start debugging by pressing the green play icon


  • reload your page in the browser and the debugger will stop on lines 2 and 3 where we set the breakpoints. open vscode (if you don't have two screens) and follow code execution step by step.


There are also some videos on youtube: https://www.youtube.com/watch?v=poty5nKk2m4


If XDebug slows down your server you can simple enable/disable it via laragon. This will require only two clicks and reload apache automatically :)


  • Like 6
  • Thanks 1
Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...
  • 1 year later...
  • 5 months later...


I followed instruction at first step (  bernhard ) , all is ok , however .. at this step

"create a testfile, eg home.php and set the debug config to "PHP" "

I have something different in my Visual Studio , I have this

How can I proceed ? What folder should I setup and what is lanuch.json ? Really no idea at this step .

I want that when I click Ctrl+f5 ("run without debugging") Visual studio open the browser to http://localhost/myscript.php
but when I do this Ctrl+f5 , Visual studio ask me to choose an enviroment between PHP and Node.js , I select PHP but nothing happens.


Link to comment
Share on other sites

  • 3 months later...
On 2/3/2020 at 2:35 PM, graziano said:


Sorry @graziano

I had to use and install XDebug today and stumbled over this as well. For future reference or others having the same problem this is what worked for me:

  // 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": 9000
      "name": "Launch currently open script",
      "type": "php",
      "request": "launch",
      "program": "${file}",
      "cwd": "${fileDirname}",
      "port": 9000

Fortunately VSCode now has a direct link and this file should be created automatically once you click on it:


Once the launch.json file exists the panel will change and you will be able to listen for xdebug:


  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...