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
.dll
file tophp_xdebug.dll
and 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.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
- For Xdebug v2.x.x:
- Congrats! You have installed the debug. You can add
launch.json
to add debug options in vscode - Now your awesome journey begins: By pressing the
F5
you can enjoy breakpoints