3

I have tried a lot but not been able to understand the steps involved in debugging a PHP website residing on a remote server with eclipse Indigo PDT and Xdebug. Following is my configuration.

Remote: LAMP, Xdebug(fully setup)

Local: LAMP, Eclipse PDT with RSE,

My main problem is about the setup that I need to do locally with eclipse to be able to debug the remote website. Specifically:

  1. Do I need to create a new eclipse project locally? If yes, where should I load the source files from and how? Do I need an exact copy of the source files as on the server?

  2. Do I need to have all the files locally before I can start debugging? I copied only index.php to a local project and started debugging. I received the remote connection when I started debugging the website and could step through index.php, but not after that. If I don't need to have all the source files locally beforehand, how can I set a break point in a file that is reached after 20 function calls?

  3. What other settings need to be setup to link the local and remote projects. Do I need to add a new PHP server? What should be the settings of the debug configuration?

I know about sshfs and tried to set it up using this link: http://www.docplanet.org/php/how-to-debug-php/ but eclipse took forever to build project files on the server and hung.

I have looked all over. A good link to go with the answers will be appreciated.

Thank you.

1 Answer 1

2

I posted the question on eclipse forums too and got an answer: http://www.eclipse.org/forums/index.php/mv/msg/365474/890896/#msg_890896

So here are the answers:

  1. Yes, you need source files and an eclipse project locally. No debugger delivers source files. I read on SO that for PHP we only need the lines that are being debugged to be same, while for C# the whole project has to be a copy.

  2. Yes, you need the files locally and set your break point in them.

  3. One thing I found is that you don't need to start the debugger like we do with normal projects. Eclipse starts accepting the debugging connection the moment you setup the debugger. So you just need to open the webpage with debugging enabled and eclipse will catch the connection and let you know.

Sign up to request clarification or add additional context in comments.

4 Comments

I was also trying to debug a remote website and am still confused after reading your answer. If I have to have a local version of the website and manually FTP the file being modified, why is it called remote debug? Because it is like I download the whole website, debug it, and then upload it back. Also, what about the databases? Do I also have to have a local copy of them?
It's called remote debug because the web requests for the pages go to the remote PHP server. You can then "catch" that request on the server mid flight and see PHP at work, from your local machine. It's not necessary to edit the files for debugging. What you describe sounds like the regular development process - make changes to local files, test & debug locally, and upload the files to the server. If you can run a local PHP server, and connect to the actual database (only connection, not a whole copy of it) you might be able to reproduce the issue locally, and won't need remote debug.
My website has a huge file system, is it possible that when I open a page, the listening IDE just downloads the related PHP file for me to debug, then after I find the problem, make the change, and click save, the IDE uploads the file back to the server?
I don't work with PHP anymore, so I'm probably out of date. But check out my link to the eclipse forums in the answer, I mention sshfs. That seems to be what you are looking for. I also mention it was too slow for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.