ActiveState Powered by ActiveState

ActiveState Community


uri mapping problem (was newbie questions ...)

Posted by mhahnca on 2007-05-05 00:54

This is another problem I am trying to isolate from the long list in the first thread. I apologize for all these posts, but I am still trying to get my basic development environment working.

My original question ------

4) I can't see to be able to get URI mapping working for my remote PHP ... The mapping I'm setting up seems obviously simple so I don't see how I could be getting it wrong. Every file that appears in the editor has the lock icon and is different from the files in my project. If I take the trouble to single step through my code until I can get a locked file to appear then I can set a breakpoint, but breakpoints in my project files do nothing.

A response ----------

4) How do you access files on your remote site? You should be able to map an http:// uri to files on a remote server using an existing remote files server definition. Is that what you are doing?

My new response -------

I understand now that I have to have a project point to the remote copy of the files using the server definition. I created a new project this way. Using that project I can edit the remote files directly. I'm using an SCP connection.

Let me show you all my settings:

Actual url:
http://elleh.com/catalog/elleh-main.php?XDEBUG_SESSION_START=administrat...

Server definition:
Server Type: SCP
Name: elleh.com
Hostname: elleh.com
User Name: root
Password: ****** (ActiveState tech support can see this if they want)
Default Path: /

Mapped URIs:
URI: http://elleh.com
Local Path: scp://elleh.com/var/www/vhosts/elleh.com/httpdocs

When I browse to the actual URL above, I hit a break in a newly opened source window in komodo. It has a lock icon. The path it shows when hovering over the tab is:
dbgp:///file:///var/www/vhosts/elleh.com/httpdocs/catalog/elleh-main.php

The file in my project shows this path:
scp://elleh.com/var/www/vhosts/elleh.com/httpdocs/catalog/elleh-main.php

Can you help me find out what I'm doing wrong?

ToddW | Mon, 2007-05-07 10:35

Mapped URIs:
URI: file:///var/www/vhosts/elleh.com/httpdocs
Local Path: scp://elleh.com/var/www/vhosts/elleh.com/httpdocs

Generally you should use filename part of the dbgp string, thats everything starting after the "dbgp:///" section.

Cheers,
Todd

mhahnca | Mon, 2007-05-07 15:36

I thought the URI meant the actual URL that requested the page, but using the path returned by xdebug makes a lot of sense.

Unfortunately it still doesn't work. I tried these three:

URI: file:///var/www/vhosts/elleh.com/httpdocs
Local Path: scp://elleh.com/var/www/vhosts/elleh.com/httpdocs

URI: dbgp:///file:///var/www/vhosts/elleh.com/httpdocs
Local Path: scp://elleh.com/var/www/vhosts/elleh.com/httpdocs

URI: file:///var/www/vhosts/elleh.com/httpdocs
Local Path: c:\elleh.com\httpdocs

Any idea how to proceed?

ToddW | Mon, 2007-05-07 16:12

The example I tried, which worked for my remote debugging, running remotely on linux and locally on WinXP, used the following configuration:

URI: file:/var/www/vhosts/elleh.com/httpdocs
Local Path: scp://elleh.com/var/www/vhosts/elleh.com/httpdocs

Note the single forwardslash after file (as that is what the title of my Komodo document said when it was not mapped "dbgp:///file:/var/www/....").

Does that help?

mhahnca | Mon, 2007-05-07 18:30

I tried one and two slashes. Still no luck.

The title of my document had three slashes as I said before. I wonder why ours differ?

BTW: I tried the xdebug you provided and the latest from their site. It didn't make a difference. I think they were the same file.

ToddW | Tue, 2007-05-08 13:10

I just tried this again, with PHP 5.1.6 running with Apache 2 on Linux and running Komodo (4.0.3) on Windows XP and it still was working for me.

For PHP debugging I received the a file URI with three forward slashes, so I had to update my URI mapping to match:
dbgp:///file:///srv/www/htdocs/...

What platform are you running Komodo upon and what platform are you running PHP remotely upon?

Ensure you this Komodo preference enabled:
Debugger->Debugger/Editor Integration->Try and find files on the local system when remote debugging

It may also be something to do with the remote connection (did you use the "Remote" button on the URI mapping dialog), can you browse to and open that file location using Komodo's remote file dialog?

Thanks,
Todd

mhahnca | Tue, 2007-05-08 14:24

> What platform are you running Komodo upon and what platform are you running PHP remotely upon?

My setup is exactly the same as yours: PHP 5.16, Apache 2, linux, and komodo 4.0.3 on XP.

> For PHP debugging I received the a file URI with three forward slashes

The beginning (dbgp:///file:///) is exactly what I get.

My "Try and find files" preference has always been on, I tried using the remote button, and the remote file dialog works fine.

Still no luck.

I have an idea. If you email me your komodo ip etc, I wil point my debugger to your komodo. I can also give you the root login to my remote server. Actually, if I give you root login you can change the debugger pointing yourself.

This way we can at least find out if it is a local or remote problem.

mhahnca | Tue, 2007-05-08 19:25

I apparently can't do anything right. I haven't been able to get the proxy working. Maybe you can help?

I started the proxy on elleh.com with this:

[root@elleh ~]# python ./pydbgpproxy.py > proxy-output.txt &
[1] 5052
[root@elleh ~]# INFO: dbgp.proxy: starting proxy listeners. appid: 5052
INFO: dbgp.proxy: dbgp listener on 127.0.0.1:9000
INFO: dbgp.proxy: IDE listener on 127.0.0.1:9001

I exited that ssh session and checked from a separate ssh session and it is still running.

I set my php.ini to:

; xdebug config for Linux and Mac OS X
zend_extension= /usr/lib/php/modules/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey=administrator

The only change from the working xdebug before was remote_host.

My komodo prefs are set to listen on the specific port 9000 (I got an error when I tried using a free port). They are also set up for a proxy at elleh.com:9001.

When I try to turn on listening in Komodo it says the debugger proxy could not be contacted.

Do I have to do something to enable port 9001 on linux? I didn't set up my server, I'm using plesk, and plesk mentions nothing about any firewall.

P.S. My router is still set up to pass port 9000 to the pc my komodo is running on. No other incoming port is needed for komodo, right?

ToddW | Tue, 2007-05-08 20:59

Try using the machine name, like this:
dbgpProxy -i elleh.com:9001 -d elleh.com:9000 > proxy-output.txt &

Otherwise it will only be a local connection, which means outside hosts (your Komodo IDE) won't be able to connect.

I don't know a lot about plesk, but if Komodo does not connect after running the above command then it may be a problem, you can try "telnet elleh.com 9001" from your Komodo client PC to see if it is available.

Cheers,
Todd

mhahnca | Tue, 2007-05-08 22:14

I've got half the proxy working. Your change worked and my komodo listener status now says it is listening. Unfortunately xdebug is not causing any break in komodo. I've restarted apache and my php.ini is the same as what I posted above.

You can try it now. Use elleh.com:9001.

I've tried it in 4.03 and 4.1.

BTW, I started another thread about a problem I'm having setting up a project with a remote folder. Project settings can't affect the problem this thread is about, can it?

ToddW | Wed, 2007-05-09 09:42

I just tried the proxy, though it's either down or a firewall is blocking my connection.

When you setup the proxy settings in Komodo's preferences, you need to specify the proxy key that will be used to indicate to break for your running Komodo (most people use a username).

When you request to debug a php page through the browser, you must use the same proxy key. I.e. for me I'd use "toddw" as:
http://elleh.com/catalog/elleh-main.php?XDEBUG_SESSION_START=toddw

This then sends to the proxy and the proxy tries to find a matching "toddw" entry in it's IDE connections, if one is found it sends to it else it ignores the breakpoint request (which is likely why it's not stopping for your Komodo).

Cheers,
Todd

mhahnca | Wed, 2007-05-09 09:52

The proxy stopped for some reason. It is going again now:

python ./pydbgpproxy.py -i elleh.com:9001 -d elleh.com:9000 > proxy-output.txt &

INFO: dbgp.proxy: starting proxy listeners. appid: 25132
INFO: dbgp.proxy: dbgp listener on elleh.com:9000
INFO: dbgp.proxy: IDE listener on elleh.com:9001

I have my key set in komodo to administrator and my XDEBUG_SESSION_START=administrator. I didn't have to change this. It worked fine without the proxy.

mhahnca | Wed, 2007-05-09 10:33

This morning when I tried it yet again the proxy and uri mapping worked. I swear on a stack of bibles I didn't change anything.

Oh well. Even though I don't need the proxy I'm not about to change anything.

Thanks for all the trouble.

mhahnca | Wed, 2007-05-09 10:48

My local (local apache remote) xdebug has started mapping correctly also. I definitely did not change that preference, even by accident, and there is no proxy involved.

There was apparently something broken in the URI mapping that got unbroken.

ToddW | Wed, 2007-05-09 11:29

Well, good to hear that it is working now.

You may want to turn off the dbgp proxy and go back to direct debugging (or to setup firewall rules to control access to that port). As a sufficiently motivated person could do something malicious, such as to alter the execution of your PHP code (to run their own PHP code).

Cheers,
Todd

-->