xdebug breakpoint support with lighttpd rewrite/alias?

I seem to be having troubles getting the xdebug to work with breakpoints in my configuration of lighttpd when using rewrite and aliases. I'm curious if there is a different way of doing things that might allow it to work properly.

I've set up the following parameters in the php.ini related to xdebug (trying various combinations of settings to see if i could get it to work)

zend_extension=xdebug.so

xdebug.remote_enable=1

xdebug.profiler_enable=1

xdebug.remote_log=/var/log/lighttpd/xdebug_remote.log

xdebug.remote_connect_back=1


phpinfo shows that xdebug is working with remote capability on port 9000 and my fastcgi setup is using a php.socket file (I have also tried this using port 9009)

I have a default www directory set up as the server root, but what I am trying to do is to set up so I can have multiple host roots under path aliases so I can use a single server to debug multiple configurations. (I may try virtual hosting yet, but I'm trying to keep things as simple as possible)




server.document-root = "/var/lighttpd/www"




So for example, my rewrite rules for a zend framework skeleton look like:




url.rewrite-once = (
        ".*\.(js|ico|gif|jpg|png|css|htm|html)$" => "$0",


        "^/ZF2Skel/(.*)$"   => "/ZF2Skel/index.php?$1",
)




But due to the way zend uses a 'public' folder as it's site-root, I have the ZF2Skel directory outside of the www tree and alias it similar to the following:




alias.url += ("/ZF2Skel" => "/var/lighttpd/ZF2Skel/public")




It will stop on breakpoints for php files I throw into the www directory, but for some reason, either due to the rewrite rule or the alias, it will not trigger breakpoints or otherwise function with Xdebug in any of the rewrite/alias site trees.



Any suggestions on how I might get this to work? I'd like to start adding other configurations/sites into the lighttpd setup such as a laravel site or another Zend.




SW
0
3 comments

Hi there,

First of all -- check your xdebug.log and see what it says about it.

In general URL rewriting or symbolic links usage does not matter. You just need to remember few things:

1) correct letter case especially on Mac (regardless of the file system) and Linux

2) xdebug works with final/resolved paths only -- the log should tell you what file and path did trigger it

3) In PhpStorm you have to setup correct path mappings so that IDE could map the path seen by xdebug to the path IDE is working with (Settings (Preferences on Mac) | Languages & Frameworks | PHP | Servers)

0

That's part of the thing. I added the log entry to try to see what is  happening, but nothing is happening when I try to go to one of the aliased/rewrite paths. (no entries show up in the log, no stop points occur)

I have two configurations set up in phpstorm. One starts at the www root and is the one I used to test a stop point in a generic index.php file (in www folder) which works. Obviously, since the ZF2Skel tree is not under the same site root, the only way I can see those files is to open them manually or include them in the 'External libraries'. I added the path also to the settings under the Deployment mappings, and it shows the alert path is 'out of project'. (I figured this would work though as I am able to get stop points to work in things like the Zend libraries on my server and such)

My other configuration starts at the ZF2Skel root and the server configuration includes the /ZF2Skel prefix in the defined server path. On this i have an in place deployment that includes the ZF2Skel public path mapped to /ZF2Skel and the www path mapped to /. Incidentally, if I go to servers->validate and set 'Local Path to create validation script' (in either configuration) to point to www it will show it as properly configured. But if I set either to the [....]/ZF2Skel/public it says 'Failed to execute validation script' but it appears to be properly translating the mapping as the message is 'Could not read from "http://localhost/ZF2Skel/_intellij_phpdebug_validator.php" because it is not a file.'

So it is either not able to put it in the right place for some reason or it is not behaving as expected when it gets there.

Mind you, the site works fine under this alias/rewrite scheme (assuming there are no php errors) and navigation of the links is not a problem.

SW

0

It's hard for me to say what exactly is going on there from overhere, especially since I have not used lighttpd myself (only Apache/IIS/nginx (a bit)).

I may suggest to temporarily set xdebug.remote_autostart = 1 to tell xdebug to attempt to debug every single script -- at least you may see more from there.

PhpStorm cannot upload files that are outside of the project root .. but can debug them as long as it can map the paths and local copy is available.

0

Please sign in to leave a comment.