ID: 42198 Updated by: [EMAIL PROTECTED] Reported By: hans at parse dot nl -Status: Open +Status: Assigned Bug Type: CGI related Operating System: Linux PHP Version: 5.2.4RC1 -Assigned To: +Assigned To: jani New Comment:
Yes, that's one way to do it..though I still think the issue is more in how mod_alias/mod_userdir handle the doc_root and might be the proper place to fix it..but I'm not so familiar with lighttpd internals so I could be wrong. Including my patch in 5.2.4 is up to Ilia to decide. :) Previous Comments: ------------------------------------------------------------------------ [2007-08-07 14:56:13] hans at parse dot nl Ah, i didn't know about the Apache ticket but it looks like exactly the same issue. Nice work on that, hope it makes it into php-5.2.4 :) I applied your patch to php-5.2.4RC1 and adapted Lighttpd mod_fastcgi.c so it exactly matches your Apache results. My patch for lighttpd-1.4.16 can be found here: http://home.parse.nl/~hans/temp/mod_fastcgi.diff Can you please check if you get proper results with it aswell? Would be great if we can tackle this :) ------------------------------------------------------------------------ [2007-08-07 13:10:10] [EMAIL PROTECTED] And FYI, about PHP_SELF: http://www.php.net/reserved.variables (yes, it's supposed to contain PATH_INFO..) ------------------------------------------------------------------------ [2007-08-07 13:08:05] [EMAIL PROTECTED] See bug #31892 (It's about Apache) I fixed the issues there with this patch (against latest CVS checkout of PHP_5_2): http://pecl.php.net/~jani/patches/bug_31892.patch I then tried the same on lighttpd but no luck: Lighttpd sets PATH_TRANSLATED incorrectly, debugged it and saw it was set to this: PATH_TRANSLATED: /opt/www//foo/bar/ PATH_INFO: /foo/bar/ SCRIPT_FILENAME: /home/jani/t.php SCRIPT_NAME: /r/t.php PHP_SELF: /r/t.php REQUEST_URI: /r/t.php/foo/bar/?bar=foo Obviously when there's this alias/userdir lighttpd still uses document root to set the PATH_TRANSLATED with (I checked the actual value lighttpd sets it to, it's not the one PHP modifies..). Lighttpd seems to ignore the script name totally too. Under apache it now works (when my patch is applied) as expected: PATH_TRANSLATED: /home/jani/t.php/foo/bar/ PATH_INFO: /foo/bar/ SCRIPT_FILENAME: /home/jani/t.php SCRIPT_NAME: /r/t.php/foo/bar/ PHP_SELF: /r/t.php/foo/bar/ REQUEST_URI: /r/t.php/foo/bar/?bar=foo ------------------------------------------------------------------------ [2007-08-07 12:35:44] hans at parse dot nl Heh i was pondering and typing a apache2handler example and then i saw your Apache comment. Here it is anyway: -- Yes i agree, my patch is kinda hacky but solved my personal userdir problem ;) The alias problem was someone else's which i overlooked. Your alias example suffers from the same problem as userdirs, being that the DOCUMENT_ROOT always points to the docroot of the host, but as i already pointed out, this is also the case in apache/mod_php5 or apache2handler, not just cgi-fcgi. apache2handler actually is an even bigger mess :) for example: request: http://www.site.com/~hans/info.php/foo/bar result: _SERVER["DOCUMENT_ROOT"] /var/www/site.com/www/htdocs _SERVER["REQUEST_URI"] /~hans/info.php/foo/bar _SERVER["SCRIPT_NAME"] /~hans/info.php _SERVER["PATH_INFO"] /foo/bar _SERVER["PATH_TRANSLATED"] /var/www/site.com/www/htdocs/foo/bar _SERVER["PHP_SELF"] /~hans/info.php/foo/bar Not really consistent, and also an invalid PATH_TRANSLATED, and PATH_INFO added to PHP_SELF ?! Anyway, back to Lighttpd. I'll try to whip up a less hacky fix that also handles the aliases. ------------------------------------------------------------------------ [2007-08-07 11:51:55] [EMAIL PROTECTED] Then again same happens with Apache too.. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/42198 -- Edit this bug report at http://bugs.php.net/?id=42198&edit=1