Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do PHP source files need to exist locally AND remotely when using XDebug remote debugging in eclipse?

I'm really confused about XDebug remote debugging using Eclipse.

I use Windows (with eclipse and all that jazz) to do my development, but I would like to test my code in the same environment as my production environment.

I have been tinkering with XDebug remote debugging to support this. I have correctly configured XDebug on the remote machine and made sure the ports were open. But what's really puzzling me is - do the source files on my machine need to also exist on the remote server running PHP and XDebug? Right now I do not have any PHP executables on my local development machine so there's no possible way the scripts can be run on it.

Thanks

like image 243
Sam Levin Avatar asked Dec 02 '13 02:12

Sam Levin


1 Answers

Yes, the identical set of files needs to exist on the server and client.

The files on the server are the ones that actually get run during your debugging session.

The files on the client are what Eclipse will show you when the debugger halts at a breakpoint. The server will tell Eclipse that it stopped at line X of file Y, and Eclipse will show you line X of file Y from the local file set. So if the local file is different from the remote file, you'll be debugging the wrong thing and it will be chaos.

Note that it doesn't matter if you can't run PHP on the client. The client files aren't being executed, just displayed in the debugging session.

If you make any edits to the local files, you'll need to resynchronize them with the server. There are several methods for doing that, some built into Eclipse, in the RSE plugin for example. I prefer to use Unison, or a version control commit back to the server.

like image 184
Andrew Schulman Avatar answered Sep 21 '22 12:09

Andrew Schulman