From: Matti A. <ma...@ik...> - 2002-10-31 21:13:12
|
Hi! I just hacked together a PhpWiki site using the latest nightly PhpWiki tar package and Apache 2.0.40 with PHP 4.2.3 provided by Mandrake 9.0. In the process I stumbled into something I think must be a bug. But first, the setup: PhpWiki resides in /phpwiki (relative to docroot). I tried to make the PATH_INFO stuff to work as described in index.php and PhpWiki Wiki pages, by making /wiki and putting the following lines to .htaccess: Action x-phpwiki-page /phpwiki/index.php SetHandler x-phpwiki-page DirectoryIndex /phpwiki/index.php Instead of a working Wiki I got 404's. Clearly, the handler delegation didn't work with Apache 2.0. After a huge amount of trials and errors I ended up with a seemingly working setup: /wiki/.htaccess: --clip-- DirectoryIndex /phpwiki/index.php RewriteEngine On RewriteBase /wiki/ RewriteRule ^(.+)$ /phpwiki/index.php/$1 [QSA] --clip-- also, a following line has to be added to /phpwiki/.htaccess: AcceptPathInfo on With these settings, the Home Page loaded correctly. The problem was, I only got the Home Page, no matter where I went. Now, after another huge amount of trials and errors, I narrowed the problem down to PATH_INFO_PREFIX setting. The variables are set as follows: _SERVER["REQUEST_URI"] /wiki/AddingPages _SERVER["SCRIPT_NAME"] /phpwiki/index.php _SERVER["PATH_INFO"] /AddingPages _SERVER["PATH_TRANSLATED"] /var/www/mairas.net/html/AddingPages _SERVER["PHP_SELF"] /phpwiki/index.php/AddingPages However, PhpWiki assumes that PATH_INFO has the VIRTUAL_PATH (in this case '/wiki') as prefix. As can be noted, that isn't the case. I found out the following patch fixes the problem for me (TM): --clip----clip----clip----clip----clip----clip----clip----clip----clip-- --- /tmp/phpwiki/lib/config.php 2002-09-27 16:40:34.000000000 +0300 +++ lib/config.php 2002-10-31 22:09:29.000000000 +0200 @@ -336,7 +336,13 @@ if (VIRTUAL_PATH != SCRIPT_NAME) { // Apache action handlers are used. - define('PATH_INFO_PREFIX', VIRTUAL_PATH . '/'); + // There are differences in Apache versions in rgd. to how PATH_INFO is + // assembled. Test what the prefix should look like. + if (substr($HTTP_SERVER_VARS['PATH_INFO'],0,strlen(VIRTUAL_PATH))==VIRTUAL_PATH) { + define('PATH_INFO_PREFIX', VIRTUAL_PATH . '/'); + } else { + define('PATH_INFO_PREFIX', '/'); + } } else define('PATH_INFO_PREFIX', '/'); --clip----clip----clip----clip----clip----clip----clip----clip----clip-- The fix may not be pretty, but without it PhpWiki does not work for me. Please consider applying it to the CVS. Best regards, Matti Airas |