Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

REMOTELY Debugging PHP Using Eclipse

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?

like image 836
Joshua Avatar asked Feb 01 '10 01:02

Joshua


People also ask

Why is PHP debugging difficult?

Debugging a PHP application if often more difficult than debugging an application in some other programming language. There are two reasons for this. First, a PHP application rarely consists of only PHP code. (Note that we are discussing here the typical use of PHP in a Web application.

Is there a PHP debugger?

A: You can easily debug PHP in Chrome using a simple extension called PHP Console. Just install this PHP debugging tool from the Chrome web store and start logging errors, warnings, exceptions, and vars dump on your Chrome browser.


2 Answers

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

  • setting-eclipse-pdt-and-xdebug
  • Debugging PHP applications with xdebug

One 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.

like image 78
Justin Ethier Avatar answered Sep 22 '22 11:09

Justin Ethier


  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" :-)
like image 28
prodigitalson Avatar answered Sep 18 '22 11:09

prodigitalson