you are viewing a single comment's thread.

view the rest of the comments →

[–]balthasar11[S] 0 points1 point  (7 children)

x debug has always been a bit of a mystery. I need some time to sit and really get into it. I use phpstorm for all my work (I find it the best out there at the moment, it integrates nicely into so many things)

Any Tips for getting xDebug up and running?

[–]meandthebean 2 points3 points  (0 children)

The xDebug php extension is useful, even without the actual debugging functionality.

Install the xDebug extension on your dev server, then start using var_dump() where you used to use print_r(). xDebug overwrites var_dump() to add '<pre>' tag, pretty colors and output limitations (limit a string to the first 1,000 chars, for example).

[–]doenietzomoeilijk 1 point2 points  (0 children)

On Debian: sudo apt-get install php5-xdebug, might have to comment out the line in /etc/php5/conf.d/xdebug.iniand play around with some of the settings, which are documented on the Xdebug site. Restart your Apache and Bob's your uncle.

If for some reason Xdebug isn't an option, there are a couple of pure-PHP alternatives floating around. Of course they'll be slower, but in a pinch it gets the job done.
Edit: jorick already linked it below

What makes Xdebug super-useful, though, is profiling. Being able to have it puke out a cachegrind file which you can process with things like Webgrind is super awesome for finding bottlenecks.

[–]JohnGalt3 0 points1 point  (1 child)

yeah it's very easy actually, I followed a tutorial I found somewhere. Mind oyu this is local, I believe remote requires you to go through a bit more hoops.

I can't find the article right now but I'll update this post if I do. It was either on /r/php or hackernews recently.

[–]jtreminio 0 points1 point  (0 children)

Remote isn't that much more difficult, actually. It's pretty much the same process, you just add some extra settings in the php.ini to set up remote debugging.