From: Colm D. <col...@gm...> - 2006-01-12 03:56:17
|
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.=20 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 |
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 |
From: Colm D. <col...@gm...> - 2006-01-12 13:30:36
|
Hi Jamie, On 12 Jan 2006 15:12:39 +1100, Jamie Cameron <jca...@we...> wrote: > 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 .. Do you see any issues with me patching my own miniserv.pl to just never define PATH_TRANSLATED as a stopgap solution until a better patch is found? It seems to work fine and AFAICS it would not break any of my existing webmin perl CGIs because none of those or the associated webmin perl libraiers seem to use PATH_TRANSLATED. Thanks, Colm |