Monday, February 15, 2021

How to on debugging in visual code studio

 Step 1: Install the PHP Debug in your vs code.


Step:2 Open your Xampp and click on config and open the php.ini File


Step:3 copy the code and past your php.ini file.


Step 4: Install XDebug. Online Wizard  helps you, just post here phpinfo() data. Save in phpinfo.php this:

<?php phpinfo(); ?>

then open in browser localhost/phpinfo.php


Step 5: copy everything you see (Ctrl+A then Ctrl+C) to wizard. It shows you obtained info and steps to do: 



And Click on 
Analyse my phpinfo() output Button...

Step 6: Generate the debugging form wizard


Step 7: Goto visual code click on Add Configuration + 
Listen for XDebug


Step 8: Setting php.ini file final code like.. 

[XDebug]
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_port = 9000
zend_extension = C:\xampp\php\ext\php_xdebug-3.0.2-7.3-vc15-x86_64.dll

Step 8: Restart the webserver Enjoy your Debugging is working.


Error



Output




2 comments:

  1. For new 7.4 vesion
    xdebug.mode = debug
    xdebug.start_with_request = yes
    zend_extension = C:\xampp\php\ext\php_xdebug-3.1.1-7.4-vc15-x86_64.dll

    ReplyDelete
  2. [XDebug]
    xdebug.mode = debug
    xdebug.start_with_request = yes
    zend_extension = xdebug

    ReplyDelete

If you have any problem please let me know.