How to install and configure PHP Debugger on Windows and Visual Studio Code

Share this post on:

One of the most common ways while you are writing code in PHP is to use the var_dump() command to debug the output of a written code, but another way in case of facing errors is to install PHP Debugger

Install PHP Debugger for vscode

  1. Open the terminal, and type this command: php -v (remember the version of the PHP that is installed on your Windows)
  2. Use this link and download the appropriate file of Xdebug for your PHP version
  3. Rename the .dll file to php_xdebug.dll and move it to C:\php\ext\ or any other preferred path.
  4. In all steps, you can check your configurations using the command php --ini
  5. Go to the PHP installation directory and open the php.ini file with a text editor such as Notepad and then paste the lines in the “extensions” section:
    • For Xdebug v2.x.x:
      • zend_extension=C:\php\ext\php_xdebug.dll
      • xdebug.mode=debug
      • xdebug.start_with_request=yes
  6. Congrats! You have installed the debug. You can add launch.json to add debug options in vscode
  7. Now your awesome journey begins: By pressing the F5 you can enjoy breakpoints
Share this post on:

Author: Mahroo Gholami

Gholami is a software developer in Gordarg. She believes in the power of moments and their importance. She is a graduate of computer engineering. In her free time she observes the night sky, goes hiking, and reads psychology books.

View all posts by Mahroo Gholami >