[pmwiki-users] there's still trouble down on t' farm

Patrick R. Michaud pmichaud at pobox.com
Tue Mar 15 09:46:24 CST 2005


On Tue, Mar 15, 2005 at 03:41:47PM +0900, rickla wrote:
> In the field's local/config.php file, I have lines like:
> 
> include_once("$FarmD/cookbook/extendmarkup.php");
> include("$FarmD/cookbook/bibtexref/bibtexref2.php");
> 
> All the cookbook recipes I've called in this way are working fine.
> This is what fooled me into thinking things were going ok. In fact, I
> just happen to have tackled cookbook things first this time around.
> Attempting to do similar things with scripts, I tried, for example,
> 
> include_once("scripts/rss.php");
> include_once("$FarmD/scripts/rss.php");
> 
> and both versions with single quotes and got a PHP error every time.

You got a PHP error?  What error?  

Your second version is the correct one -- i.e., it should be

    include_once("$FarmD/scripts/rss.php");

with the double quotes.

> In addition, every attempt to set $ScriptUrl and $PubDirUrl failed, so
> I commented out these two. In actual fact, I'm very confused about
> what $ScriptUrl actually means. The name suggests that it tells PmWiki
> where to fetch scripts from, but that doesn't make much sense because
> "include" does the same thing. 

No, they're totally different.  The key is to recognize the difference
between working with urls and files on disk.  The include() statements
are used to include other files (on disk) into the currently running
PmWiki script.  Thus they require filename paths. 

The $ScriptUrl and $PubDirUrl variables are used to tell a *browser*,
connecting via the webserver, how to execute the pmwiki script
($ScriptDirUrl) and the base url for getting files from PmWiki's
pub/ directory ($PubDirUrl).  Note that a browser needs a 
url (http://www.example.com/pmwiki/pub) while an include statement 
requires a file path ($FarmD/scripts/something.php).

Also note that a browser never accesses the files in scripts/ or
the cookbook/ directly, but always goes through the pmwiki.php
script, as specified by $ScriptUrl.

> sample-config.php says that it's "your
> preferred URL for accessing wiki pages", which implies to me that you
> could write any URL you liked and it would be redirected to the actual
> page, but that doesn't seem very likely. Can anyone give a simple
> explanation?

$ScriptUrl is the url that you want people's browsers to use when
accessing PmWiki, either as a field or farm.  It's used whenever
PmWiki needs to generate a link to another PmWiki page or action.
PmWiki is usually fairly good about "guessing" the correct value for
$ScriptUrl on its own, but sometimes an admin needs to set it explicitly
because of url manipulations by the webserver (e.g., CleanUrls, mod_rewrite,
errors in the PHP configuration, etc.).

If the system works without setting $ScriptUrl and you're happy with
the results, then don't change it.  :-)

Pm



More information about the pmwiki-users mailing list