views:

446

answers:

4

Hi,

I've using Netbeans to develop on a windows machine, the files I'm editing are on a remote LAMP server. The document root is mounted on my windows machine as a drive letter (Y:). So, netbeans things I'm developing locally, whereas I'm actually developing remotely on a local mount.

My problem starts when I want to use xdebug and netbeans to debug CLI PHP scripts. Debugging browser based stuff is fairly straight forward, but debugging CLI stuff is a little more convoluted and I'm not sure I know how to get it working.

The first problem is that, Netbeans wants to know where the php5 interpreter is, but I can't tell it as it's on the remote server...

Does anyone have any experience with doing this?

Thanks,

Mike

A: 

I don't know about Netbeans, never used it, but in Eclipse PDT where you can also debug using XDebug there is a distinction between "PHP web page" and "PHP script". For "PHP web page" you choose a web server (that you configured earlier) and not a php interpreter (like you have to do with "PHP script").

Perhaps there's the same thing for Netbeans?

Jan P.
A: 

The key Netbeans PHP debugging breakthrough came for me when I added a path mapping to my project (under Project Tab|Right-click Project|Properties|Run Configuration|Advanced Button), so that my project knew how to correlate server source code paths to the local paths (windows drive letter paths).

Example path map:

/home/myusername/sourcedir mapped to x:\sourcedir

I believe I work with a similar configuration to yours (LAMP server, windows machine with the source from the LAMP machine showing up locally under a windows mapped drive). This worked for me.

I had been trying the URLs for my project (http://server/projectroot) as the path mapping. That was not what was needed. The actual path on the server (i.e. my home directory and below) was needed.

DWright
A: 

The xdebug.remote_host variable refers to the host that xdebug should connect. You can debug PHP on a remote server using NetBeans, but it would require you to configure xdebug on the remote server such that it would connect to your development PC.

Here's a simple example: Your development PC, with NetBeans, is on 10.0.0.100, and your remote PHP webserver is on 10.0.0.1 Set the xdebug.remote_host=10.0.0.100 Now whenever someone (or you) specified the XDEBUG_SESSION_START parameter in the URL on the remote server, xdebug would try to connect to 10.0.0.100.

Xdebug v2.1 has a nice feature: xdebug.remote_enable = 1 Enabling that option would override xdebug.remote_host and then xdebug would connect to the $_SERVER['REMOTE_ADDR'] (which is the IP address that the client is connecting from). This awesome feature would allow you to have multiple debugging on the same server, since you can't manipulate xdebug.remote_host with ini_set()

Pada
A: 

Pada meant: xdebug.remote_connect_back, not xdebug.remote_enable. You must have both of them set in order for Xdebug to auto-connect back to Netbeans (or whatever the debugger).

Peter Kehl