Possible to remote xdebug a PHP site that uses extensive routing? (no way to map php files to URLs)

The website I maintain is run on nginx and has a dozen rules to rewrite/route requests to specific files based on the request URL.  For example, every single request, regardless the URL, routes the request through php-fastcgi to /path/to/system/loader/index.php, which requires a file somewhere else in the filesystem called code/launch.php.  So that's the entry point for the entire app.  Not a single URL ends in .php.  The php files to require/load are determined during runtime based on the query string.  So, because of this, there is no way to map a request URL to a single php file.  So a request like /calendar/2011/11/11 may route to require/include 20 unrelated framework-like files before it loads the code that handles the calendar module.  I've tried other PHP IDEs in the past and never remote debugging to work.  The only debugger I can get to work is to run vim on the server the hosts the files with an xdebug plugin.  So far I love PHPStorm, but the ability for remote debug to work is crucial.

Is there any way I can get this working with my current setup?

Thanks so much!

P.S. It's not feasible to run the site locally.  Unfortunately, it relies on a specific distribution and a specific arrangement of code across the filesystem.  It's a real mess, but I have to deal with it.

1 comment
Comment actions Permalink

Hi Josh,

I'm sure you know that a lot of (if not almost all) modern frameworks have their own routing implementations -- instead of having individual rewrite rules executed by web server (mod_rewrite for Apache, URL Rewrite Module for IIS and so on) they have routing implemented in PHP, so you can build dynamic URLs at any time or store them in DB etc. If you look at WordPress, for example, it has like single rewrite rule -- forward all requests for non-existing resources to index.php.

The above .. plus the fact that xdebug works with actual files (full path to the file which is executed) and not URLs .. makes debugging of such URLs the same as debugging requests for real .php pages (e.g. /help/delivey.php)

So yeah -- it's possible to make it work -- just setup proper path mappings (local file system <--> remote file system) at Settings | PHP | Servers. Obviously, this assumes that all involved (on remote side) files are also present locally.

0

Please sign in to leave a comment.