FeaturesPluginsDocs & SupportCommunityPartners

NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Getting remote debugging to work

 
Post new topic   Reply to topic    NetBeans Forums -> PHP Users
View previous topic :: View next topic  
Author Message
Pete Ford
Posted via mailing list.





PostPosted: Wed Oct 14, 2009 9:19 am    Post subject: Getting remote debugging to work Reply with quote

I keep being frustrated by this, but today I've had some success. I just
wanted to share the details as I see them, and ask if this is the only
way to do it.
My configuration (in this case) is a Ubuntu 9.04 development machine,
running VirtualBox with a OpenSuSE 10.3 guest containing my Apache 2.2
server with PHP 5.2.9 and a PostgreSQL 8.3 database.
My dev machine is whizzy (192.168.0.4), and the server is vwhizzy
(192.168.0.27). Most of this detail should not be important (except for
Linux dev environment and Linux server - no windows stuff in this case),
but I provide it in case my quoted stuff below references it.
The project name is 'trms'

1. On the server, the web root is /srv/www/htdocs/trms, so on the dev
machine, I created a directory /srv/www/htdocs/trms to mirror the
structure of the server, and make sure it's owned by the development
user and world-readable.
2. In the Netbeans project properties: Sources section, I check 'Copy
files to another location' and set the location to /srv/www/htdocs/trms.
3. I use sshfs to mount the server web root on the development machine
like this: 'sshfs vwhizzy:/srv/www/htdocs/trms /srv/www/htdocs/trms'.
Usually I delete anything that Netbeans has already copied to that
folder because I know that the server-side files are up-to-date. Anyway,
now any further changes that I make in Netbeans are copied to the
server's web root directly.
4. On the server, I configure xdebug:
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=192.168.0.4 #The dev machine
xdebug.remote_port=9000
xdebug.remote_mode=req
xdebug.idekey=netbeans-xdebug
and restart apache.

5. Start debugging the project in Netbeans, and it works - firefox
opens, the breakpoints get hit in the appropriate files and all is good.
I usually turn off the "Stop at the first line" option because I'm using
an MVC structure and I don't usually need to step through the controller.



As far as I can tell, the CRITICAL bits appear to be matching the name
of the project to the name of the web root folder, and mirroring the
directory structure of the server on the dev machine. It seems that
missing either of these stop the breakpoints working properly. If anyone
can shed light on why that would be, I'm interested.

An additional challenge would be to use a Windows machine as the dev
machine. I have tried using a SMB share as the "Copy files" location but
I ended up with permission problems - that one needs to be revisited
sometime when I have to work on a Windows PC...
Back to top
Pet
Posted via mailing list.





PostPosted: Wed Oct 14, 2009 9:47 am    Post subject: Getting remote debugging to work Reply with quote

On Wed, Oct 14, 2009 at 11:19 AM, Pete Ford <address-removed> wrote:
Quote:
I keep being frustrated by this, but today I've had some success. I just
wanted to share the details as I see them, and ask if this is the only way
to do it.
My configuration (in this case) is a Ubuntu 9.04 development machine,
running VirtualBox with a OpenSuSE 10.3 guest containing my Apache 2.2
server with PHP 5.2.9 and a PostgreSQL 8.3 database.
My dev machine is whizzy (192.168.0.4), and the server is vwhizzy
(192.168.0.27). Most of this detail should not be important (except for
Linux dev environment and Linux server - no windows stuff in this case), but
I provide it in case my quoted stuff below references it.
The project name is 'trms'

1. On the server, the web root is /srv/www/htdocs/trms, so on the dev
machine, I created a directory /srv/www/htdocs/trms to mirror the structure
of the server, and make sure it's owned by the development user and
world-readable.
2. In the Netbeans project properties: Sources section, I check 'Copy files
to another location' and set the location to /srv/www/htdocs/trms.
3. I use sshfs to mount the server web root on the development machine like
this: 'sshfs vwhizzy:/srv/www/htdocs/trms /srv/www/htdocs/trms'. Usually I
delete anything that Netbeans has already copied to that folder because I
know that the server-side files are up-to-date. Anyway, now any further
changes that I make in Netbeans are copied to the server's web root
directly.
4. On the server, I configure xdebug:
Back to top
WGH



Joined: 14 Oct 2009
Posts: 2

PostPosted: Wed Oct 14, 2009 11:36 am    Post subject: Reply with quote

Remote debugging is quite not finished. I'm unable to make it work.
Dev system (NetBeans) is Windows, debugging system (Xdebug) is Debian.
I made NetBeans find which file xdebug_break() is in, however when I set breakpoints in NetBeans, they don't work. Pathnames match (C:\www\proj\proj and /www/proj/proj, where the last component is webroot). Web root in NetBeans project properties is set.
Back to top
View user's profile Send private message
radek matous
Posted via mailing list.





PostPosted: Wed Oct 14, 2009 12:04 pm    Post subject: Getting remote debugging to work Reply with quote

WGH wrote:
Quote:
Remote debugging is quite not finished. I'm unable to make it work.

Dev system (NetBeans) is Windows, debugging system (Xdebug) is Debian.

I made NetBeans find which file xdebug_break() is in, however when I set breakpoints in NetBeans, they don't work. Pathnames match (C:\www\proj\proj and /www/proj/proj, where the last component is webroot). Web root in NetBeans project properties is set.

Did you try support for path mapping in Netbeans (since 6.7)
http://blogs.sun.com/netbeansphp/entry/path_mapping_in_php_debugger

Radek
Quote:









Back to top
Pete Ford
Posted via mailing list.





PostPosted: Wed Oct 14, 2009 12:23 pm    Post subject: Getting remote debugging to work Reply with quote

WGH wrote:
Quote:
Remote debugging is quite not finished. I'm unable to make it work.

Dev system (NetBeans) is Windows, debugging system (Xdebug) is Debian.

I made NetBeans find which file xdebug_break() is in, however when I set breakpoints in NetBeans, they don't work. Pathnames match (C:\www\proj\proj and /www/proj/proj, where the last component is webroot). Web root in NetBeans project properties is set.










Yeah, that's pretty much the problem I had with a Windows dev machine
last time I tried it.
Back to top
Pete Ford
Posted via mailing list.





PostPosted: Wed Oct 14, 2009 12:24 pm    Post subject: Getting remote debugging to work Reply with quote

radek matous wrote:
Quote:
WGH wrote:
Quote:
Remote debugging is quite not finished. I'm unable to make it work.

Dev system (NetBeans) is Windows, debugging system (Xdebug) is Debian.
I made NetBeans find which file xdebug_break() is in, however when I
set breakpoints in NetBeans, they don't work. Pathnames match
(C:\www\proj\proj and /www/proj/proj, where the last component is
webroot). Web root in NetBeans project properties is set.

Did you try support for path mapping in Netbeans (since 6.7)
http://blogs.sun.com/netbeansphp/entry/path_mapping_in_php_debugger

Radek
THAT might be what I need to simplify / generalise my setup - it's a
pain having to create a mirro of the web server file structure
(especially if you don't have root...)
Back to top
WGH



Joined: 14 Oct 2009
Posts: 2

PostPosted: Wed Oct 14, 2009 7:32 pm    Post subject: Re: Getting remote debugging to work Reply with quote

radek matous wrote:
Did you try support for path mapping in Netbeans (since 6.7)
http://blogs.sun.com/netbeansphp/entry/path_mapping_in_php_debugger

Radek

Oh, didn't try that one because my Debian is in VirtualBox and I didn't need to upload files. Path mapping helped me, thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> PHP Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB