From: Oliver B. <ob...@de...> - 2004-05-16 18:59:02
|
Hello All, after a server update (now PHP 4.3.6 running as CGI with Apache/1.3.29) at my web hoster, PATH_INFO is empty, and the information contained now in ORIG_PATH_INFO. The same for PATH_TRANSLATED, but PhpWiki doesn't seem to use this. I don't know whether this can/will be changed on the part of the hoster, but maybe there is a simple way for me to adapt PhpWiki. Any hint how I can solve this problem with minimal changes tp PhpWiki code? I want to avoid to patch future PhpWiki installations, so maybe a simple solution is to copy the contents of ORIG_PATH_INFO to PATH_INFO? I have to admit that I have only rudimentary knowledge about PHP. TIA, Oliver -- Oliver Betz, Muenchen |
From: Whit B. <wh...@tr...> - 2004-05-16 19:24:55
|
It would be a pretty simple patch to cover this, but I don't know offhand what the ORIG_ prefix means - is it just a customization your host has made? I don't see any mention at all on php.net. So it's probably a patch that would only make sense on your host, that you'd best handle on your own. Anyway, the patch to insert would look something like: if (!isset($PATH_INFO)&&isset($ORIG_PATH_INFO)) { $PATH_INFO=$ORIG_PATH_INFO; } Where to put that? Before the first time $PATH_INFO gets called in each pass through. Shouldn't be too hard to find, but I haven't looked. Whit On Sun, May 16, 2004 at 08:58:34PM +0200, Oliver Betz wrote: > Hello All, > > after a server update (now PHP 4.3.6 running as CGI with > Apache/1.3.29) at my web hoster, PATH_INFO is empty, and the > information contained now in ORIG_PATH_INFO. The same for > PATH_TRANSLATED, but PhpWiki doesn't seem to use this. > > I don't know whether this can/will be changed on the part of the > hoster, but maybe there is a simple way for me to adapt PhpWiki. > > Any hint how I can solve this problem with minimal changes tp PhpWiki > code? I want to avoid to patch future PhpWiki installations, so maybe > a simple solution is to copy the contents of ORIG_PATH_INFO to > PATH_INFO? > > I have to admit that I have only rudimentary knowledge about PHP. > > TIA, > > Oliver > -- > Oliver Betz, Muenchen |
From: Reini U. <ru...@x-...> - 2004-05-16 20:11:11
|
Whit Blauvelt schrieb: > It would be a pretty simple patch to cover this, but I don't know offhand > what the ORIG_ prefix means - is it just a customization your host has made? > I don't see any mention at all on php.net. So it's probably a patch that > would only make sense on your host, that you'd best handle on your own. > > Anyway, the patch to insert would look something like: > > if (!isset($PATH_INFO)&&isset($ORIG_PATH_INFO)) { > $PATH_INFO=$ORIG_PATH_INFO; > } if (USE_PATH_INFO && !isset($_SERVER['PATH_INFO']) && isset($_SERVER['ORIG_PATH_INFO'])) { $_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO']; } Somewhere in IniConfig.php:fix_config() or if you omit the USE_PATH_INFO check, you can put it into index.php also. That's the smallest file. The first usage is very late, in main.php:_deducePagename() > Where to put that? Before the first time $PATH_INFO gets called in each pass > through. Shouldn't be too hard to find, but I haven't looked. > > Whit > > On Sun, May 16, 2004 at 08:58:34PM +0200, Oliver Betz wrote: > >>Hello All, >> >>after a server update (now PHP 4.3.6 running as CGI with >>Apache/1.3.29) at my web hoster, PATH_INFO is empty, and the >>information contained now in ORIG_PATH_INFO. The same for >>PATH_TRANSLATED, but PhpWiki doesn't seem to use this. >> >>I don't know whether this can/will be changed on the part of the >>hoster, but maybe there is a simple way for me to adapt PhpWiki. >> >>Any hint how I can solve this problem with minimal changes tp PhpWiki >>code? I want to avoid to patch future PhpWiki installations, so maybe >>a simple solution is to copy the contents of ORIG_PATH_INFO to >>PATH_INFO? >> >>I have to admit that I have only rudimentary knowledge about PHP. -- Reini Urban http://xarch.tu-graz.ac.at/home/rurban/ |
From: Oliver B. <ob...@de...> - 2004-05-16 22:50:27
|
Reini Urban <ru...@x-...> wrote: > if (USE_PATH_INFO && > !isset($_SERVER['PATH_INFO']) && > isset($_SERVER['ORIG_PATH_INFO'])) > { > $_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO']; > } sorry, I forgot to mention that I use PhpWiki 1.3.7. $_SERVER['PATH_INFO'] = doesn't work, although I checked whether I can change the values (with a simple script containing phpinfo()). I could fix also the other occurences of PATH_INFO listed in the phpinfo() output with _ENV[] and putenv() but PhpWiki still showed the HomePage regardless of the path. > The first usage is very late, in main.php:_deducePagename() $pathinfo = $this->get('ORIG_PATH_INFO'); worked finally. Not a really clean solution, but for the moment, I prefer it over the ?pagename= method. I still wonder whether this is a configuration problem of my web hoster, or a PHP issue, or the new standard behaviour... Thanks for the help, Oliver -- Oliver Betz, Muenchen |
From: Oliver B. <ob...@de...> - 2004-05-16 22:50:27
|
Whit Blauvelt <wh...@tr...> wrote: > It would be a pretty simple patch to cover this, but I don't know offhand > what the ORIG_ prefix means - is it just a customization your host has made? > I don't see any mention at all on php.net. So it's probably a patch that > would only make sense on your host, that you'd best handle on your own. http://bugs.php.net/bug.php?id=21575 and http://bugs.php.net/bug.php?id=23800 mention it. Strange that the search function doesn't find both... It can be configured (cgi.fix_pathinfo in php.ini), but I'm not sure whether it is a bug or intended behaviour, so I can't tell my web hoster to change it. Any comments? Thanks, Oliver -- Oliver Betz, Muenchen |
From: Reini U. <ru...@x-...> - 2004-05-16 23:16:08
|
Oliver Betz schrieb: > Whit Blauvelt <wh...@tr...> wrote: >>It would be a pretty simple patch to cover this, but I don't know offhand >>what the ORIG_ prefix means - is it just a customization your host has made? >>I don't see any mention at all on php.net. So it's probably a patch that >>would only make sense on your host, that you'd best handle on your own. > > > http://bugs.php.net/bug.php?id=21575 and > http://bugs.php.net/bug.php?id=23800 mention it. Strange that the > search function doesn't find both... > > It can be configured (cgi.fix_pathinfo in php.ini), but I'm not sure > whether it is a bug or intended behaviour, so I can't tell my web > hoster to change it. No this is indented behaviour with CGI now. Your hoster will not change it, that's the new default setup for CGI. We have to find a way around it. Thanks for bringing this to our attention. -- Reini Urban http://xarch.tu-graz.ac.at/home/rurban/ |
From: Whit B. <wh...@tr...> - 2004-05-17 03:29:21
|
On Mon, May 17, 2004 at 01:17:59AM +0200, Reini Urban wrote: > No this is indented behaviour with CGI now. Your hoster will not change > it, that's the new default setup for CGI. > > We have to find a way around it. Thanks for bringing this to our attention. Reini, There used to be no PATH_INFO for CGI (as I read the explanations), then they fixed it, then they set the default in php.ini to not use the fix, since that could break some old scripts looking for a related variable. So the present technique would have never worked on PHP as CGI, then would have briefly worked (since php.ini defaulted to use it at first), then would have ceased working as he reports for just those cases where php.ini isn't intentionally set to use the fix. (Without the fix, both ORIG_PATH_INFO and PATH_INFO should be empty without the fix, given a CGI PHP.) So yeah you can't depend on the fix being there or not. Maybe the way he found of using the phpinfo() function is a way around it? Think you could use ini_get('cgi.fix_pathinfo') to test if the fix is set - although you'd really want to check if it's even running as CGI first, not sure how. I imagine at some point the PHP crew will change the default back again to the fixed state, since that would bring this into conformance with the CGI standard, which they're a bit concerned with. Whit |
From: Whit B. <wh...@tr...> - 2004-05-16 23:16:27
|
On Mon, May 17, 2004 at 12:50:04AM +0200, Oliver Betz wrote: > http://bugs.php.net/bug.php?id=21575 and > http://bugs.php.net/bug.php?id=23800 mention it. Strange that the > search function doesn't find both... Eh. I was using php.net's link to the Google search that gave: "Your search - ORIG_PATH_INFO site:www.php.net - did not match any documents." - but of course that's not searching bugs.php.net. > It can be configured (cgi.fix_pathinfo in php.ini), but I'm not sure > whether it is a bug or intended behaviour, so I can't tell my web > hoster to change it. > > Any comments? The PHP manual seems to be totally lacking on this. However there's a comment in php.ini about it: ; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's ; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok ; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting ; this to 1 will cause PHP CGI to fix it's paths to conform to the spec. A setting ; of zero causes PHP to behave as before. Default is zero. You should fix your scripts ; to use SCRIPT_FILENAME rather than PATH_TRANSLATED. ; cgi.fix_pathinfo=0 So it looks like your host is running PHP as a CGI, and that in CGI mode PHP formerly didn't really have access to PATH_INFO so it just wasn't provided (it was available in the more usual mode of running PHP as an Apache module). However, the related PATH_TRANSLATED was kludged to copy the available SCRIPT_FILENAME value. Then this was fixed for one version of PHP, but that broke scripts expecting to find that kludged value or SCRIPT_FILENAME, so php.ini was set to have cgi.fix_pathinfo=0 - which breaks things for you because you need the fix to be ther for the PATH_INFO variable. So ... your provider can change to cgi.fix_pathinfo=1 (removing that ";" before it) in php.ini, and you'll be good - but anyone else on the system using PATH_TRANSLATED in a script (this could be grepped for) needs to change to SCRIPT_FILENAME or their script will then be broken. Whit PS: Reini is of course right on the "SERVER_" stuff - I'm don't always run in safe mode (too many old, old scripts). |
From: Oliver B. <ob...@de...> - 2004-05-17 06:30:40
|
Reini Urban <ru...@x-...> wrote: [...] > No this is indented behaviour with CGI now. Your hoster will not change > it, that's the new default setup for CGI. although I don't understand what empty PATH_INFO and PATH_TRANSLATED variables are good for - but I don't need to know. > We have to find a way around it. Thanks for bringing this to our attention. The information is also in REQUEST_URI (direct, _SERVER and _ENV), it contains '/phpinfo.php/foobar', but I don't know whether this is a reliable place to look for the additional path info. Oliver |
From: Reini U. <ru...@x-...> - 2004-05-17 11:33:49
|
Oliver Betz schrieb: > Reini Urban <ru...@x-...> wrote: > [...] > >>No this is indented behaviour with CGI now. Your hoster will not change >>it, that's the new default setup for CGI. > > although I don't understand what empty PATH_INFO and PATH_TRANSLATED > variables are good for - but I don't need to know. > >>We have to find a way around it. Thanks for bringing this to our attention. > > The information is also in REQUEST_URI (direct, _SERVER and _ENV), it > contains '/phpinfo.php/foobar', but I don't know whether this is a > reliable place to look for the additional path info. Yes, we will change this to the difference from $REQUEST_URI to $SCRIPT_NAME. That's the reason why all CGI installations with USE_PATH_INFO = true failed. It's only to seperate the script from the args. seperatd by / instead of ? & pairs. But today I will finally move, so better expect it tommorrow. -- Reini Urban http://xarch.tu-graz.ac.at/home/rurban/ |
From: Oliver B. <ob...@de...> - 2004-05-17 06:30:40
|
Whit Blauvelt <wh...@tr...> wrote: [finding info on php.net] > - but of course that's not searching bugs.php.net. but even searching bugs.php.net doesn't show all entries. [...] > So it looks like your host is running PHP as a CGI, and that in CGI mode PHP yes, also in the previous setup. > formerly didn't really have access to PATH_INFO so it just wasn't provided > (it was available in the more usual mode of running PHP as an Apache > module). However, the related PATH_TRANSLATED was kludged to copy the > available SCRIPT_FILENAME value. Then this was fixed for one version of PHP, > but that broke scripts expecting to find that kludged value or > SCRIPT_FILENAME, so php.ini was set to have cgi.fix_pathinfo=0 - which I'm not sure whether I understand your explanation, but in the previous setup, PATH_INFO contained the expected string - regardless of how PHP managed this. PhpWiki worked "pretty", although 1.3.7. didn't detect it automatically and I had to set USE_PATH_INFO. And in the actual version, SCRIPT_FILENAME, ORIG_SCRIPT_FILENAME, _SERVER["SCRIPT_FILENAME"], _SERVER["ORIG_SCRIPT_FILENAME"], _ENV["SCRIPT_FILENAME"], _ENV["ORIG_SCRIPT_FILENAME"] all contain the same string, the full path to the script, e.g. /homepages/u8765/test/phpinfo.php So I don't know what other value scripts could have been expecting. ut I really shouldn't think about the details too much as long as I have no clue about CGI. Oliver |