views:

208

answers:

5

I'm a self-taught noobie, trying to debug PHP on my GoDaddy hosted server. Is this idea even rational, or do I need to continue to do all development locally and just continuously re-ftp upload the changes?

Is there some way that I can use eclipse to step through, and debug my php scripts that are hosted on a third party site?

A: 

I have never needed to do a step by step debug in PHP, but when I do need to debug I just output strings of the variables at that point.

However, one thing that I found, but again never used, was FirePHP:
http://www.firephp.org/

Nathan Adams
A: 

As far as I'm aware, this is not possible in Eclipse, it is, however, possible in NetBeans, but as Nathan stated, I've never really needed to remote debug any of my PHP scripts.

Alex
XDebug and Netbeans are great for PHP debugging. It even has built-in support for transferring remote files using scp. Although it can be a bit of a pain to debug a framework such as CodeIgniter that does not use GET variables. That said, I believe it is possible to use XDebug with Eclipse as well...
Justin Ethier
+2  A: 

Although I have only used Netbeans and XDebug for remote debugging, it should be possible to use Eclipse PDT and XDebug. See:

On caveat, however. To configure xdebug you will need to modify some settings in php.ini - I am not sure if this will be possible on a hosted server. If not, you would need to have a local server that you use for debugging, and would need to figure out another solution for your "production" environment. Which may not be a bad idea, actually, as it would give you a good place to test your changes without risking breaking anything on your actual site.

Also, I recommend that you look into Netbeans, if for no other reason than to experiment and see what it can do compared to Eclipse. One nice feature is that you can set it up to automatically ftp (or scp) changed files to the remote site. So you can make some code changes, click the debug button, and after waiting a moment for your files to upload you can be stepping through code on the remote site.

Justin Ethier
+2  A: 
  1. While there is definitely a case for remote debugging you should always be working locally and then uploading. Anything except the most minor of changes should be done locally tested then pushed to a server - sometimes production directly, sometimes a testing server...
  2. Yes Eclipse supports remote debugging with Xdebug as well as the one from Zend Debugger check out Justin's links as well as This one for Zend Debugger. I think Zend has an all in one with pdt+deps and Zend Debugger - ofcourse you still need to set up the extension on the server (note link is for setup on windows but hte process should be similar).
  3. Obligatory "Ewww GoDaddy" :-)
prodigitalson
+1 for "Ewww GoDaddy. Ewww indeed. :)
Alex
So who should I be using instead of GoDaddy and... Back it up with a good "Why" or two.
Joshua
@josh: Because in my mind they will always be linked with hosting and domain registration/transfer/expiration of colleagues. I just dont trust them. Nor do i trust 1and1. That said its not a quantantative "ewww"... its more a matter of preference (hence the emoticon) - id rather put my money and my clients at Linode, ServerGrove, SliceHost, MediaTemple or if its not mission critical and they are on a super tight budget - Dreamhost.
prodigitalson
A: 

If the web server have XDebug installed, then you can do debugging with it. Searching for it in google yield a quite num of articles on how to do it.

Personally, I'm using CodeIgniter. I do debugging using FirePHP and PQP. Make a habit to write a good indented code. You might find your code have less bug, both syntax and logic, and easier to maintained in the future. Use a consistent white space, either tab or space. Use a consistent bracket style. It will save you from the headache when re-read it for bug or adding more feature later.

Donny Kurnia