From: Jamie C. <jca...@we...> - 2006-01-12 04:12:49
|
On Thu, 2006-01-12 at 14:56, Colm Dougan wrote: > 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? Hi Colm, Thanks for pointing this out - this is definately a bug in Webmin, as it shouldn't even be setting PATH_TRANSLATED unless there is PATH_INFO data. Worse still, it was being set wrongly anyway! I never noticed this before, because none of the CGI programs in Webmin make use of it .. - Jamie |