How to debug PHP in Visual Studio Code (Simple steps)
ฝัง
- เผยแพร่เมื่อ 14 ต.ค. 2024
- I set up my debugger today and created this quick video to help you in case you want to debug PHP in Visual Studio Code.
Settings to enter in PHP.ini (from the video)
zend_extension = xdebug
[XDebug]
xdebug.mode = debug
xdebug.start_with_request = yes
There are many "how to" xdebug setup videos for PHP in VS Code. None of them explained this at all. This is the only video that actually worked. Who knew the settings.json line items had to be manually inserted? Nobody has explained this before. Now I can accelerate my work to a much greater degree. I am very grateful my friend.
Very clear - worked first time! Much easier than a lot of the other misleading guides.
On a new VSCode install the debug options for running in browser are not there - it seems some step was missed - you must have some other extension installed or configuration you did not go over.
Also telling people to use search for the settings.json only works if you've ever opened it before
settings.json is stored in c:\users\YOUR_USERNAME\AppData\Roaming\Code\User\settings.json
but would be easier to find if you told folks to go to the PHP Debug addon then click on the settings icon then select extension settings then click the "edit in settings.json" to find it
The video was fairly helpful but it's assuming a lot - probably because you already have things installed and configured that you take for granted.
OK so missing critical info - I was just testing by making a random php file with some code in it - in that case the run just runs /debugs to console
however, I tried pointing vscode to open a directory where apache was serving from c:\xampp\htdocs and then had debug and run create a launch.json for it - THEN I was able to get the run options mentioned.
Over all the video was helpful, and saved me a lot of steps but there are quite a few assumptions
@@digital_sorceress Thank you.
@@digital_sorceress Thank you! It is a right comment at right place. I stuck into the same problem and your comment helped me finally solve it.
Thanks, Jeet.
You seem to have made light of the reality that many cannot do the "step through" the code! You focused on set-up which is very helpful. But what use is set-up when I can't use it!
When you have the php file open you can click off just to the left of a line number to set a breakpoint ... the breakpoints checkboxes in the run debug should be checked for the php file and then when you run it should stop at the point you set.. you should then be able to use f10 to step over f11 to step in f5 to continue etc..
Thank you for the concise and easy to follow video. Teaching me more than my course!
It was a bit difficult to find settings.json, the way you show it in video didnt work for me but then somehow accidently I found it and it works, thank you so much for your tutorial !
Thanks Jeet.
A useful and informative video but I am having some problems.
I have installed XAMP and Xdebugger and it seems to work for debugging current open script and I can step through code etc.
However, the option for "Listening for Xdebug" does not seem to be working and the debugger does not start when I load the local Web page on APache?
Can you offer any further help is to what may be wrong?
Please check very first comment made by @digital_sorceress. There is the answer to your question.
Thank you for the straightforward tutorial, worked like a charm!
Thank you so much. Very helpful for me. Don't meet any problem while installing. Just following your video step by step. Great
hi, nice video, i had one question, do you had to use composer to create that app ?? i tryiet this on my own proyect but i failed hehe, thanks
Thanks. I would also like to see a set-up of this on Linux.
Você é o cara. Me salvou. Obrigado.
Hey Jeet, I followed the steps but the debugger is not getting hit can you help me with the configuration of 'launch.json' too?
This doesn't seem to work - I still just get the "Welcome to XAMPP for Windows" /dashboard/ page...
This helped me a lot! Thank you!
thanks bro this was very clear. helped me a lot
you save me a lot of time, thank you, very clear
Thanks. This is really helpful.
Simply and easy! Thanks
Happy to see your new video!
thanks for your video it was so helpful for me!
Thanks you man you are very helpfull
its not working , it asking me create launch.json file
thx man, you are amazing :)
Thanks a bunch for the help! The debug works now 👍
Anyone knows about a good tutorial for installing Xdebug in MacOS, PHP 8.1
am not getting setting.json file
please help me
Amazing video, thanks!
Cant find settings.json
@@thecodeiseverything can you explain it
c:users\xxxx\AppData\Roaming\code\users\settings.json that folder may be hidden
Thank you, very usefull!
Thanks a bunch!
THANK GOD
thankyou sir g
Thanks.
thx bro
Thanks
did not worked at all
X Debug tried. OMG must have been designed to debug this sole code. It's a joke. Please dont publish useless info
you are not my best friend stop saying that it is so weird to hear🙄
you using xampp so you wrong
i don't have settings.json