[webmin-devel] PATH_TRANSLATED environment variable in miniserv.pl

Colm Dougan <[email protected]>
Newsgroups gmane.comp.web.webmin.devel
Message-ID <[email protected]>
Hi,

I was trying to run a php script I obtained as a CGI using a php4
binary with miniserv.pl but kept running into the "No input file
specified" error message.

After a bit of Googling I found that a common problem withr running
php CGIs in this way is that the SCRIPT_FILENAME enviroment variable
may not have been defined - however I see that this is defined in
miniserv.pl after some discussion of this I found in the archives [1].
 Anyway - that wasn't my problem, just a bit of backgroud.

I traced the C code of the php4 binary when running my php CGI until I
found that it was failing when doing a fstat() on a filename it had
opened which turned out to be a directory and not a file as expected. 
It turns out it is basing this on the PATH_TRANSLATED environment
variable which miniserv.pl had defined as the same as my document
root.

I had a look at the CGI spec [2] which stated the following for
PATH_TRANSLATED :

  PATH_TRANSLATED is derived by taking any path-info component
  of the request URI (see section 6.1.6), decoding it (see
  section 3.1), parsing it as a URI in its own right, and
  performing any virtual-to-physical translation appropriate to
  map it onto the server's document repository structure. If the
  request URI includes no path-info component, the
  PATH_TRANSLATED metavariable SHOULD NOT be defined.

I found the last bit interesting so I tried editing miniserv.pl to not
define PATH_TRANSLATED and suddenly everything started working.  So -
is it possible that PATH_TRANSLATED is not being defined correctly
here, or iare there cases where it should not be defined as seems to
be being suggested here?

Thanks,
Colm

[1] http://lists.swelltech.com/pipermail/webmin-devel-archive/2002-October/000750.html
[2] http://cgi-spec.golux.com/draft-coar-cgi-v11-03.txt


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
-
Forwarded by the Webmin development list at [email protected]
To remove yourself from this list, go to
http://lists.sourceforge.net/lists/listinfo/webadmin-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.