Configure XDebug on VSCode for any PHP Project

If you don’t want to read this long thread, then the video is for you.

Follow these steps to configure XDebug in VSCode:

  • Save your project as a workspace in VSCode
  • Install PHP debugger extension in VSCode.
  • Install xdebug on your system. https://xdebug.org/docs/install
  • Create a test.php and add phpinfo() inside that file.
  • Access that file into your browser. You will see your phpinfo like this
  • Select everything you see on this page and add it to xdebug wizard.
  • Follow the xdebug wizard https://xdebug.org/wizard instructions.
  • After following xdebug wizard instructions, add these two lines to your php.ini:
    xdebug.client_host = localhost
    xdebug.client_port = 9003
  • Restart Apache/Sevrver( MAMP, XAMP, WAMP )
  • Go to debugger and create a launch.json
  • Select project
  • Select PHP
  • Your json file is generated now and it will look like this
  • Listen for Xdebug.
  • Add a breakpoint where you want to debug. Click on the line number to set break point
  • Open the site in the browser and visit the page where your code executes where you added a breakpoint.
  • You will see the debugging info in debugger

That’s it !!!!

Related Articles

Install wp-cli on windows

WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, configure multisite installs and much more, without using a web browser.

So I am going to tell you short, simple and easy way that how to use wp-cli on windows system.