this post was submitted on 08 Aug 2023
22 points (89.3% liked)

Programming

17313 readers
206 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 1 year ago
MODERATORS
 

I have no idea how I managed to program in PHP for years without Xdebug. Now when an error occurs, it just pops up in my IDE, and I can set breakpoints and see ALL of the local variables including the ones set in the higher up scripts. It makes debugging sooooo much easier.

I feel kind of silly for not assuming a tool like this existed and hunting for it. I'll never write a var_debug() again. I wonder what other absolutely vital tools are out there that I'm just completely oblivious to.

top 7 comments
sorted by: hot top controversial new old
[–] Vince 3 points 1 year ago (1 children)

Lol, I have my favorite file_put_contents line for debugging php, but being able to step through code would be great. What's your setup? Last time I tried I couldn't get xdebug working on win server + apache.

[–] [email protected] 5 points 1 year ago* (last edited 1 year ago) (1 children)

I'm on Ubuntu, but from what I remember to get it working in my local environment I just:

  • Installed the module.
  • Added the following to the php.ini file:
    [xdebug]
    zend_extension=xdebug
    xdebug.mode = debug
    xdebug.start_with_request = yes
  • Restarted the apache server.
  • Installed the PHP Debug extension for Visual Studio Code.

And now I just hit F5 and select "Listen for Xdebug" and I'm ready to go.

[–] [email protected] 2 points 1 year ago

You just saved thousands of php developers' lives

[–] [email protected] 3 points 1 year ago (1 children)

Just wait until you learn that you can debug sql queries the same way in most rdbms admin tools.

[–] [email protected] 2 points 1 year ago (1 children)
[–] [email protected] 5 points 1 year ago

Just wait until you learn that debuggers for XSLT exists. Wait, that's no reason to smile.

[–] kroy 1 points 1 year ago

I think part of the responsibility when you pick up a new language is understanding the framework and tools. Look at existing projects, see how they are doing things, check out a few IDEs, etc.

I dunno, I end up learning new languages to at least a junior dev level multiple times a year, and the tools and frameworks are the first thing I look at. It really seems to help me grasp the just of the language much quicker.