0

For a directory index I set the default index file name to an absolute path in the lighttpd conf file:

index-file.names += ( "index.html", "index.php", "/_h5ai/server/php/index.php" )

Inside this /_h5ai/server/php/index.php script I try to find the URL to the script itself with

$path = getenv("SCRIPT_NAME");

This works fine in Apache httpd, nginx and Cherokee. They resolve it to something like /_h5ai/server/php/index.php. But lighttpd resolves it to the current URL, e.g. /abc/, plus this absolute path: /abc//_h5ai/server/php/index.php.

Any ideas how to fix this in lighttpd?

  • see it in context: this is the critical line on GitHub
  • the tool itself: it's h5ai, but the demo is served from Apache httpd

update

already tried PHP option cgi.fix_pathinfo = 1, doesn't work :(

lrsjng
  • 2,615
  • 1
  • 19
  • 23
  • Maybe this bug applies your problem: http://redmine.lighttpd.net/issues/729 - If so, try to use "fix-root-scriptname" in your lighty FCGI configuration. – Martin M. Oct 31 '12 at 20:16
  • thanks! but doesn't apply here.. – lrsjng Oct 31 '12 at 20:25
  • isn't there also a SCRIPT_FILENAME member of ENV that holds a more useful value? could you use that value's difference from DOCUMENT_ROOT to the get real URI of the script? – Ben West Nov 01 '12 at 22:54
  • thank you, I'm using a similar approach for now.. but it still feels like a workaround/bugfix (only needed by lighttpd). but it works.. – lrsjng Nov 02 '12 at 00:27
  • Could you post the specifics of how you solved it as an answer? I'm in-particular, interested in how this applies to _h5ai – Ben West Nov 13 '12 at 17:37
  • compare these two lines here: https://github.com/lrsjng/h5ai/blob/develop/src/_h5ai/server/php/index.php#L10-11 it's solved with a regular expression that replaces everything before a `//` (and including `//`) with a single `/` – lrsjng Nov 14 '12 at 19:23

0 Answers0