From: Jeff D. <da...@da...> - 2001-04-26 17:30:33
|
>In the file config.php, there is a reference to the $SCRIPT_NAME >environment variable. This variable should I believe hold the location >of the index.php file? In my case however it comes back with >\cgi-bin\php.cgi. >Would it not therefore be better to use a different environment >variable? $PATH_INFO works in my case, but I don't know if it works for >all cases. I think the main difference is that some service providers >use the CGI Interpreter, and some use the Apache module. $PATH_INFO doesn't work when mod_php is used (PHP as Apache module). (In that case, it only contains the "tail" of the URL --- the part after that which specifies the script name.) There are (at least) three basic PHP environments: 1. Apache module (mod_php) (probably the most common setup.) 2. CGI interpreter (or "action handler") like you've got. 3. Straight CGI using a standalone PHP interper. (PHP script is marked executable and has a first line like "#!/usr/local/bin/php" on unix systems.) There isn't a simple way to get the name of the script which works in all three cases. Furthermore, while one can auto-detect whether or not PHP is being run as an apache module, it is difficult to reliably differentiate between case 2 and 3. (Note that in cases 2 and 3, it is (for the most part) the http daemon, and not PHP which determines which environment variables get set, and what values they get...) PhpWiki probably could be fixed to auto-detect the correct setting for SCRIPT_NAME in a few more cases than it does now, but I'm not sure it's worth it. It's more straightforward just to manually set SCRIPT_NAME is those cases that need it. Jeff |