PHP Debugging With VS Code
Php debugging with XDebug
We are assuming you have xampp and VS Code already in place.
1- Install php-debug extionsion of VS Code
2- Create a folder in xamp htdocs with any name say “demo”
3- Create a file (index.php) in your created folder xampp/htdocs/demo/index.php
4- Now navigate to localhost/demo you should see this screen
5- Goto XDebug installation vizard and copy paste all the content in above screen and click analyse my phpinfo()
Page should show this after click
Download dll and follow the instructions shown above
Now once you have followed above instructions and restarted your server you now need to configure VS Code to listen to Xdebug
6- Configure debugging in php.ini file
In your php info search for “Loaded Configuration File” and copy its path and paste it in your windows explorer, it will open php.ini for you
Add this at the end of this file
[XDebug]
zend_extension = C:\xampp\php\ext\php_xdebug-2.7.2-7.3-vc15-x86_64.dll
xdebug.remote_enable = 1
xdebug.remote_autostart = 1