[pmwiki-users] [PATCH] Issue with pmwiki and PHP virtual() function (SSI)

Mikael Nilsson mini at nada.kth.se
Wed Nov 9 17:23:58 CST 2005


Hi!

My main site uses SSI, even recursively in some cases, to build the page
layout (essentially includes header, footer and meta tags).

I was trying to get pmwiki installed, and created a new skin that would
follow the rest of the site *exactly*. This is actually not too hard -
just using the same template I'm using for the rest of my site, and
replacing the page text with <!--PageText-->.

To illustrate: in the header I use <!--function:includemeta -->, which
is defined in config.php:

function includemeta($x) {
   virtual("/kmr/meta.html");
}

which will include the following snippet from the meta.html file:

<link rel="stylesheet" href="/kmr/kmrstyle.css" type="text/css">
<link rel="shortcut icon" href="/kmr/favicon.png">

This corresponds exactly to the way I use SSI on the static pages:

<!--#include virtual="/kmr/meta.html"-->

And similar for header and footer.

Now, in order to show my problem, try adding the above to the default
skin (pmwiki.php), in the <head>.

When visiting the HomePage, I get the wiki site, plus:

=========================================================================
Warning: mkdir(wiki.d): Permission denied in /var/www/kmrwiki/pmwiki.php
on line 366
PmWiki can't process your request

PmWiki needs to have a writable wiki.d/ directory before it can
continue. You can create the directory manually by executing the
following commands on your server:

      mkdir /var/www/kmrweb/kmr/wiki.d
      chmod 777 /var/www/kmrweb/kmr/wiki.d

Then, reload this page.

Or, for a slightly more secure installation, try executing

      chmod 2777 /var/www/kmrweb/kmr

on your server and following this link. Afterwards you can restore the
permissions to their current setting by executing

      chmod 2775 /var/www/kmrweb/kmr

We are sorry for any inconvenience.

=========================================================================

Hmmm....

The web is in /var/www/kmrweb, the wiki is in  /var/www/kmrwiki.
Somehow, I'm guessing, the virtual() function changes the current
working dir of the PHP session, meaning that

SDV($WorkDir,'wiki.d');

no longer points to /var/www/kmrwiki/wiki.d (which has the right
permissions), but to /var/www/kmrweb/kmr/wiki.d.

However, setting

SDV($WorkDir,'/var/www/kmrweb/wiki.d');

seems to work. Almost.... I can view and edit wiki pages, but page diffs
are no longer displayed... So it seems more changes are needed. I tried 
to put together a patch (attached), replacing the above definition and 
some others with an absolute path, but that only works for my site and 
path... and I might have missed any number of situations.

Anyway, I'm contributing this in the hope that someone here knows how it 
should really be done.

/Mikael



-- 
Plus ça change, plus c'est la même chose

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pmwiki.diff
Url: /pipermail/pmwiki-users/attachments/20051110/da30ee3c/attachment.asc 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mini.vcf
Type: text/x-vcard
Size: 244 bytes
Desc: not available
Url : /pipermail/pmwiki-users/attachments/20051110/da30ee3c/attachment.vcf 


More information about the pmwiki-users mailing list