Workarounds for some IIS issues
I'm not sure if this is an actual fix, or just a workaround.
So until somebody advices, here's a couple of workarounds for problems that I've encountered with running Tiki on Windows with IIS.
missing SCRIPT_FILENAME
IIS doesn't seem to have this variable.
Therefore tiki-setup.php and tiki-install.php fail.
This pretty much stops you from running even the installation.
You can create this variable yourself by copying content from SCRIPT_NAME:
Copy to clipboard $_SERVER['SCRIPT_FILENAME'] = $_SERVER['SCRIPT_NAME'];
Some URIs on IIS are malformed. They get an additional slash before the '?' sign to separate parameters from the page name.
e.g. tiki-browse_image.php/?imageId=2 instead of tiki-browse_image.php?imageId=2
This issue pretty much disables the whole Galaxia engine on IIS.
It is caused by malformed information in REQUEST_URI.
You can fix this by creating your own REQUEST_URI from PATH_INFO and QUERY_STRING.
Copy to clipboard $_SERVER['REQUEST_URI']=$_SERVER['PATH_INFO'];
if (isset($_SERVER['QUERY_STRING']))
{
$_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
}
Simple and effective, isn't it? ð
Now as this is really only a workaround, the way I use this is to put these two fixes into a separate file, e.g. bb_WindowsFixes.php, and include_once them at the beginning of tiki-setup.php and tiki-install.php
And here's how the whole fix file looks:
Copy to clipboard <?php
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['SCRIPT_NAME'];
$_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO'];
if (isset($_SERVER['QUERY_STRING']))
{
$_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
}
?>
I hope this piece of simple code will be helpful
However one should note that this fix is valid for IIS when PHP is called in the CGI/FASTCGI mode (php.exe)
If for speed reasons PHP is called in ISAPI Mode (and you will notice the difference immediately) then there is quite another set of "server_variables" and the fix has to be altered:
Copy to clipboard CGI mode: $_SERVER['REQUEST_URI']=$_SERVER['PATH_INFO'];
ISAPI mode: $_SERVER['REQUEST_URI']=$_SERVER['URL'];
|