[Pmwiki-users] installing pmwiki2 - scripturl

Patrick R. Michaud pmichaud
Mon Sep 20 13:37:41 CDT 2004

On Sat, Sep 18, 2004 at 12:13:42AM +0200, Knut Alboldt wrote:
> I started to install pmwiki 2.0.devel5 with:
> [...]
> without modifications (just unzipping and calling pmwiki.php), the vars set 
> in pmwiki.php
>   $ScriptUrl = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
>   $PubDirUrl = preg_replace('#/[^/]*$#','/pub',$ScriptUrl,1);
> are set to a wrong value in my environment, cause $_SERVER['SCRIPT_name'] 
> is the name of the php-executable (/phpbin/php.exe) and not the name of the 
> php-script (/wiki2/pmwiki.php).

Ah, the wonderful world of having so many different PHP configurations
to choose from.  Maybe I should switch to $_SERVER['PHP_SELF'] instead?
However, I've seen at least a few environments where PHP_SELF reports
back the wrong value as well...

> To fix this I'm setting
>   $ScriptUrl = $_SERVER['PATH_INFO'];
> in local/config.php.
> But then I've to set
>    $PubDirUrl = preg_replace('#/[^/]*$#','/pub',$ScriptUrl,1);
> in local/config.php as well.
> Isn't there a better way to fix this ? e.g. setting $ScriptUrl before 
> calling pmwiki.php (but than pmwiki.php has to use SDV to set $ScriptUrl)

The better way is to make PmWiki able to figure out the appropriate values.
It'd be easier if PHP could at least have some consistencies across platforms.
But, lacking that better way, the current way to do it is to set both
$ScriptUrl and $PubDirUrl in local.php.  

(In theory one could say that PmWiki should automatically set $PubDirUrl
from $ScriptUrl, but if PmWiki cannot automatically determine $ScriptUrl
I think there's little reason to believe that it can reliably
figure out $PubDirUrl either, so it's best to just require explicit
setting of both.) 


More information about the pmwiki-users mailing list