PMWiki 101


PmWiki is a wiki-based content management system (CMS) for collaborative creation and maintenance of websites. PmWiki is superb for documentation.

Install Apache & PHP on Linux

 1. yum install httpd -y
    systemctl start httpd.service
    systemctl enable httpd.service
    Test http://localhost
 2. yum install php -y
    systemctl restart httpd.service
    systemctl enable php.service 🠈 Newer versions may not require this.
 3. Create Test File
    vi /var/www/html/pi.php 
    <?php phpinfo(); ?>
 4. Test

Security Changes

 1. Disable SELINUX if used.
    Otherwise you may get messages like this: PmWiki "Cannot acquire lockfile"
 2. Set owner and privs.
    chown -R apache:apache /var/www/html
    chmod -R 757 /var/www/html

Install PMWiki

Download software from here.

Copy to Web Server Path

If on Client PC

 • unzip to D:\sw\PMWiki\pmwiki-latest\pmwiki-n.n.nn
 • Use FileZilla to copy ...\pmwiki-n.n.nn\* to Linux systems /var/www/html/

If on Linux Host System

 • cp /var/www/html/
 • cd /var/www/html
 • unzip
   /var/www/html/pmwiki-2.2.nnn created.

Rename pmwiki-2.2.nnn to your Wiki dir name:

   mv /var/www/html/pmwiki-2.2.116  /var/www/html/MyWikiDir

Init Wiki

 • Navigate to: http://MySiteURL/MyWikiDir/pmwiki.php
   Wiki should be displayed.
 • Make any indicated changes then refresh page to confirm OK.
   Example changes:
   mkdir /var/www/html/MyWikiDir/wiki.d
   chmod 777 /var/www/html/MyWikiDir/wiki.d

Common Changes

config.php Changes

Copy Template File

 • cd /var/www/html/MyWikiDir/docs
 • cp sample-config.php /var/www/html/MyWikiDir/local/config.php

Copy Your Site Image File (if used)

 • Create Logo Image.
 • Copy Logo Image to /var/www/html/MyWikiDir/pub/skins/pmwiki
   This is the physical dir for image file (AKA PageLogoUrl).

Edit config.php
vi /var/www/html/MyWikiDir/local/config.php

 # Set Wiki Title
 $WikiTitle = 'MyTitle';

 # Set Path to Logo Image (if used)
 $PageLogoUrl = "$PubDirUrl/skins/pmwiki/MyLogo.png";

 # Set Links Default to Open in New Tab (add this to end of file)
 $UrlLinkFmt = "<a class='urllink' href='\$LinkUrl' rel='nofollow' target='_blank'>\$LinkText</a>";

 # Enable CSS line-height
 $WikiStyleCSS[] = 'line-height';

 # TimeZone (change if needed)
 putenv("TZ=EST5EDT"); # if you run PHP 5.0 or older
 date_default_timezone_set('America/New_York'); # if you run PHP 5.1 or newer

To disable link behavior for specific links use %target=_self% in front of the link.

Set Start Page (index.ext)

Ideally copy pmwiki.php to index.php or alternatively create redirect page for index.html.

<meta http-equiv="refresh" content="0;url=http://MySiteURL/MyWikiDir/pmwiki.php">
  • Google and many other search engines do not like redirect main pages. If your wiki is for local network use then redirecting index.html is OK.
  • Many cookbooks rely on pmwiki.php to exist. This is why we copy it to index.php rather than rename it.

Password Protect Site

Place at top of file: /var/www/html/MyWikiDir/local/config.php

# Custom Changes: Start ###############
$DefaultPasswords['read'] = pmcrypt('MySitePW');
# Custom Changes: End   ###############


$DefaultPasswords['admin'] = pmcrypt('MySitePW');
$DefaultPasswords['upload'] = pmcrypt('MySitePW');

Commonly Installed Cookbooks

  • AutoTOC
  • BackupHTMLZip (ensures backup files usable via Browser opening local files)
    Common Settings
      # Create "backup" directory relative to index.php where the wiki is exported.
      cd /var/www/html/MyWiki
      mkdir backup
      chown apache:apache backup
      # config.php Changes
      $BHZip['pages'] = '*.*';
      $BHZip['adminperms'] = true;
      $BHZip['squelch_hours'] = 0;
      $HandleAuth['bhzip'] = 'ALWAYS';
    cron entry:
    00 17 * * * wget -q -O /dev/null "http://localhost/MyWiki/pmwiki.php?action=bhzip"
    Example backup file in /var/www/html/MyWiki:
  • Captchas | ReCaptcha
  • CodeMirror
1. DL latest version of CodeMirror (ex: codemirror-5.59.2).
2. DL Code Mirror cookbook zip file (ex:
3. In a working directory on local PC unzip each creating:
   • D:\temp\codemirror-5.59.2
   • D:\temp\cm4pm
4. Copy entire unzipped codemirror-5.59.2 directory to /wwwroot/pub.
   Creating /wwwroot/pub/codemirror-5.59.2
5. Copy cm dir (D:\temp\cm4pm\pub\cm) to /wwwroot/pub.
   Creating /wwwroot/pub/cm
6. Copy D:\temp\cm4pm\cookbook files to /wwwroot/cookbook dir.
   cm-modes-compat.php, cm-sourceblock.php and codemirror.php.
7. Add corresponding entries to config.php
  # Codemirror Cookbook
  $CodeMirrorActivePresets['linewrapping'] = 0;
  $CodeMirrorActivePresets['autoresize'] = 1;
  $CodeMirrorPresetParams['search'] = 1;
  $CodeMirrorBaseUrl = "\$FarmPubDirUrl/codemirror-5.59.2";


Google Search

(:table :)
(:input form action="" method=get:)
(:input text name=q value="" size=9 :)(:input submit name Search:)
(:input hidden name="sitesearch" value="":)
(:input end:)

Enable Uploads

  1. Create an uploads dir under wherever pmwiki.php found. Note lower case.
  2. Make required changes to config.php
# Uploads Cfg
$DefaultPasswords['upload'] = pmcrypt('MySitePW');
$EnableUpload = 1;
$UploadPermAdd = 0;
$UploadPrefixFmt = ''; #Cfg for site-wide uploads
$UploadMaxSize = 1000000; # Upload Max File Size: 1mb=1000000, 25mb=25000000 etc.

# To find path use PHP Variable (pi.php): _SERVER["APPL_PHYSICAL_PATH"]
# Ex: D:\home\\wwwroot\
# Then from that:
#$UploadDir = "D:\home\\wwwroot\app\mp3\uploads";
#$UploadUrlFmt = "";

Note: Ensure your PHP installation allows uploads. The php.ini file needs file_uploads = On.

Example: Attach:chuck.jpg

Show All Uploaded Files: (:attachlist:)

Clean Table Look

237636507/06/17This is a test.
234413003/24/17This is another test.

Form Controls: ASCII and UNICODE Images

Complete chart here. ☑ ☐ ⮽ ★☆☀ 🖸 ⮾ ⮿ 🢧🢠 🠈🠊 🡆🡄 ✓✔

Form Controls: HTML


Authorized Content via if-ifend

(:if auth edit:)
Content here...


>>frame font-size=smaller<<




  1 2 3
  1 2 3
  1 2 3


  1 2 3
  1 2 3
  1 2 3

Standard Callouts


 >>note      fullwidth border='1px solid DarkGray' font-size=small<<
 >>important fullwidth border='1px solid DarkGray' font-size=small<<
 >>warning   fullwidth border='1px solid DarkGray' font-size=small<<

 <warning|important|tip> border='1px solid gray'

Custom Changes: <Hn> Values

Custom HTML <Hn> changes from the base install.

  • Get a color swatch for site.
  • Edit /var/www/html/oradocs/pub/skins/pmwiki/pmwiki.css as shown:
#h1, h2, h3, h6 { font-weight:normal; }

h1 { font-size:2em;    font-weight:bold; color:#0d0221;}
h2 { font-size:1.5em;  font-weight:bold; color:#0f084b;}
h3 { font-size:1.15em; font-weight:bold; color:#26408B;}
h4 { font-size:.85em;  font-weight:bold; color:#a6cfd5;}
Set the color: values to match your swatch.
  • Edit /var/www/html/oradocs/pub/skins/pmwiki/pmwiki.tmpl
Change this line:
<h1 class='pagetitle'>{$Title}</h1></div>

to this:
This ensures page title uses your <Hn> swatch value.

Enabling Javascript

   <script language="JavaScript">
       alert("Thanks to PM for that markup.");

Page Variables

 (:vPatchNumber: 29252164:)

Date\Time String via System\MarkupExpressions
 {(ftime fmt="%Y%m%d%H%M")}

References: MarkupExpressions, strftime.

Smaller Text Block

>>frame background-color=#eeeeee border='1px' font-size=smaller padding=0px width=500<<

Ei labore minimum quaestio quo. Ut vel docendi tibique, vix in quem meis
menandri, no eam labore invenire patrioque. Eu eum consul suscipiantur, 
mel ea soluta libris. Tollit laudem vim no. Aliquid intellegam voluptatibus
ad cum, lorem populo iracundia ut mei. Salutandi facilisis necessitatibus
in quo, aeque gloriatur eum an, laboramus voluptaria eu sea.

WikiStylesPlus Install Session

cd /u01/orasw/pmwiki/wsplus

cp /var/www/html/MyWikiDir/

cd /var/www/html/MyWikiDir

  inflating: cookbook/wsplus.php
   creating: pub/wsplus/
  inflating: pub/wsplus/tip.gif
 extracting: pub/wsplus/warning.gif
  inflating: pub/wsplus/
  inflating: pub/wsplus/wsplus.css
 extracting: pub/wsplus/important.gif

vi /var/www/html/MyWikiDir/local/config.php

Vanilla5 Tweeks

CSS Changes


/* --- ME Custom Changes: Start --- */

p{  padding: 0 0 0 0; }

    border-radius: 0px;
    height: 6px;
    margin: 0px 0px 0px;
    border: 0;
    clear: both;

/* --- ME Custom Changes: End --- */

Note: View standard.css to see default then change in mystyle.css.


@font-face {
  font-family: 'Lobster';
  font-style: normal;
  font-weight: 400;
  src: local('Lobster'), url(../fonts/Lobster.woff) format('woff');

/* ME CUstom Change */
@font-face {
  font-family: 'Arial';
  font-style: normal;
  font-weight: 400;
  src: local('Lobster'), url(../fonts/Lobster.woff) format('woff');


>>frame width=100pct<<
>>white-space=pre border='1px solid gray' padding=2px <<
>>teal pre background-color:lightgrey border:'medium dotted green'<<
>>frame background-color=#eeeeee border='1px' font-size=smaller padding=0px width=500<<
>>pre font-size=small line-height=125pct<<
>>frame background-color=#eeeeee border='1px' font-size=smaller padding=0px<<
>>frame background-color=#FFFFFF font-size=smaller padding=0px margin=0px <<

Upgrade Version

To upgrade to the latest PMWiki version:

0. Backup all your files.
1. DL latest PMWiki to a working dir (ex:
2. Unzip file creating corresponding version dir (ex: pmwiki-2.2.135).
3. The following dirs will be created from the zip file:
   - cookbook
   - docs
   - local
   - pub
   - scripts
   - wikilib.d
4. Copy each above dir files over (overwriting) the corresponding files on destination.
5. Test!