SourceForge logo
SourceForge logo
Menu

phpwiki-talk

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
From: Matti A. <ma...@ik...> - 2002年10月31日 21:37:49
to, 31-10-2002 kello 23:13, Matti Airas kirjoitti:
> --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--
Doh. Of course that patch gives a warning when accessing the main page
(as PATH_INFO does not exist in that case). I'm open to suggestions, how
to fix this more cleanly. :-)
m.
From: Jeff D. <da...@da...> - 2002年10月31日 22:00:11
> But first, the setup:
> ...
Hi Matti,
Try the setup described at
 http://phpwiki.sourceforge.net/phpwiki/PrettyWiki
If that works for you, I'll change the comments in index.php.
(I probably should have done that a while ago...)
From: Matti A. <ma...@ik...> - 2002年11月01日 00:36:39
pe, 01-11-2002 kello 00:00, Jeff Dairiki kirjoitti:
> Try the setup described at
> http://phpwiki.sourceforge.net/phpwiki/PrettyWiki
> 
> If that works for you, I'll change the comments in index.php.
> (I probably should have done that a while ago...)
OK, the settings below seem to be minimum settings with which I can get
it to work. It's notable that the comment in index.php suggests that
USE_PATH_INFO is by default true. Well, this is not quite true. :-)
/.htaccess:
<Files wiki>
 AcceptPathInfo on
 ForceType application/x-httpd-php
</Files>
/phpwiki/index.php:
$include_path = '.:phpwiki';
if (!defined('PHPWIKI_DIR')) 
 define('PHPWIKI_DIR','/var/www/mairas.net/html/phpwiki');
if (!defined('USE_PATH_INFO')) define('USE_PATH_INFO', true);
m.
From: Jeff D. <da...@da...> - 2002年11月01日 19:48:39
> It's notable that the comment in index.php suggests that
> USE_PATH_INFO is by default true. Well, this is not quite true. :-)
If you don't explicitly set USE_PATH_INFO, then it's value is
auto-determined by the following code (in lib/config.php):
 if (php_sapi_name() == 'apache')
 define('USE_PATH_INFO', true);
 else
 define('USE_PATH_INFO', ereg('\.(php3?|cgi)$', $SCRIPT_NAME));
I don't currently have access to a machine running Apache 2.0. (And
I don't want to install it right now...)
In order that we can try to fix the auto-detection:
Can you tell me what php_sapi_name() returns on your system.
Apparently, it's something other than 'apache'.
Also, is there way one can tell (from PHP) whether AcceptPathInfo
is on or not? I assume if (defined($_SERVER['PATH_INFO'])) then
AcceptPathInfo is enabled, but I don't think the converse is true.
(If the URL does not contain any trailing path info, then (at least
in Apache 1.3.x, PATH_INFO is undefined (not just empty).)
Jeff
From: Matti A. <ma...@ik...> - 2002年11月01日 22:25:11
pe, 01-11-2002 kello 21:48, Jeff Dairiki kirjoitti:
> In order that we can try to fix the auto-detection:
> 
> Can you tell me what php_sapi_name() returns on your system.
> Apparently, it's something other than 'apache'.
apache2filter
> Also, is there way one can tell (from PHP) whether AcceptPathInfo
> is on or not? I assume if (defined($_SERVER['PATH_INFO'])) then
> AcceptPathInfo is enabled, but I don't think the converse is true.
> (If the URL does not contain any trailing path info, then (at least
> in Apache 1.3.x, PATH_INFO is undefined (not just empty).)
If AcceptPathInfo is on, PATH_INFO behaves exactly as in Apache 1.x,
i.e. it may either be undefined or defined, depending on the actual
path.
Unfortunately I have no idea whether the value of AcceptPathInfo can be
deduced from within PHP. Maybe someone with more experience on PHP can
answer that?
However, since the preferred installation method (as described in
http://phpwiki.sourceforge.net/phpwiki/PrettyWiki) requires modifying
the top-level .htaccess or the server configuration, IMHO it would be
simpler to just provide a sample top-level .htaccess like follows:
<IfDefine APACHE2>
 AcceptPathInfo on
 ForceType application/x-httpd-php
</IfDefine>
<IfDefine !APACHE2>
 SetHandler application/x-httpd-php
</IfDefine>
Hmm... Of course, AcceptPathInfo setting should still be detected
somehow, or else it might be difficult to get PhpWiki to work reliably
out-of-the-box... Suggestions for workarounds?
Cheers,
m.
From: Jeff D. <da...@da...> - 2002年11月01日 23:02:58
Thanks for the info, Matti.
It turns out that ForceType (instead of SetHandler) works with
(at least my) Apache 1.3.x.
If updated http://phpwiki.sourceforge.net/phpwiki/PrettyWiki,
take a look and make any appropriate changes...
I see no point of fixing config.php so that it turns on
USE_PATH_INFO by default under apache 2.0, since it seems that
default installations of 2.0 don't support PATH_INFO...
If someone can figure out a way to determine whether AcceptPathInfo
is enabled or not, that would be different.
At this point, I think I'll just put a pointer to PrettyWiki in the
index.php comments...
From: Matti A. <ma...@ik...> - 2002年11月02日 02:01:05
la, 02-11-2002 kello 01:02, Jeff Dairiki kirjoitti:
> If updated http://phpwiki.sourceforge.net/phpwiki/PrettyWiki,
> take a look and make any appropriate changes...
OK, did that.
m.
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /