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
- Open the terminal, and type this command:
php -v(remember the version of the PHP that is installed on your Windows) - Use this link and download the appropriate file of Xdebug for your PHP version
- Rename the
.dllfile tophp_xdebug.dlland move it toC:\php\ext\or any other preferred path. - In all steps, you can check your configurations using the command
php --ini - Go to the PHP installation directory and open the
php.inifile 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.dllxdebug.mode=debugxdebug.start_with_request=yes
- For Xdebug v2.x.x:
- Congrats! You have installed the debug. You can add
launch.jsonto add debug options in vscode - Now your awesome journey begins: By pressing the
F5you can enjoy breakpoints