Search | Directories | Reference Tools
UW Home > UWIN > Computing and Networking > Web > Web Publishing > Installing Wikis 

Installing PmWiki

These instructions will give a basic idea of how to install PmWiki on our Web servers, and make some suggestions for ways that it can be configured. PmWiki is quite flexible, so the instructions will also include some links to ideas for customizing it to fit your intended use.

Included on this page:

Installation

  1. Log in to your Homer or Dante account with Tera Term or another terminal emulator.

  2. Press the O key for Other, then press the W key to drop into the Web development environment (Ovid, Vergil or Socrates).

  3. Change directories to your public_html directory.

    cd public_html
  4. Download PmWiki using wget.
    wget http://www.pmwiki.org/pub/pmwiki/pmwiki-latest.tgz
  5. Unzip the file you just downloaded:

    tar -xzvf pmwiki-latest.tgz

    PmWiki works at this point, but I'll lead you through a few steps that will make it easier to use.

  6. Rename the directory to something easier to remember, or perhaps something that pertains to what you're going to use the wiki for. (Note that the name of the directory you start with may change when they update the version of pmwiki at the download URL.)

    mv pmwiki-2.1.26 pmwiki
  7. Create a wrapper script so that the wiki runs by default when you load the directory.

    1. Change the to pmwiki directory.

      cd pmwiki
    2. Open a new index.html file in pico.

      pico index.html
    3. Copy this line and past it into the index.html file.

      <?php include('pmwiki.php');
    4. Press ctrl-o in pico to save the file and ctrl-x to exit.

  8. You can go to http://AccountType.washington.edu/UWNetID/pmwiki/?n=PmWiki.initialSetupTasks (where AccountType is the type of account you have and UWNetID is your own UWNetID) to see more recommended configuration and setup tasks.

Configuring Clean URLs

Your wiki should work now, but if you take the following steps, the URLs will look nicer. The steps in this section were derived from the PmWiki cookbook page "CleanUrls", using the section on URL rewriting with the .htaccess file in the PmWiki directory. The following steps assume that you are in the PmWiki directory.

  1. Open an .htaccess file for editing.

    pico .htaccess
  2. Add the following text to the .htaccess file.

    # Use mod_rewrite to enable "Clean URLs" for a PmWiki installation.
    RewriteEngine On
    # Define the rewrite base.
    RewriteBase /UWNetID/pmwiki
    # Send requests without parameters to pmwiki.php.
    RewriteRule ^$ pmwiki.php [L]
    # Send requests for index.php to pmwiki.php.
    RewriteRule ^index\.php$ pmwiki.php [L]
    # Send requests to pmwiki.php, appending the query string part.
    RewriteRule ^([A-Z0-9\xa0-\xff].*)$ pmwiki.php?n=$1 [QSA,L]

    Remember to replace UWNetID with your UW NetID.

  3. Edit your configuration file.

    pico local/config.php

    Make sure that the following lines in your config file are set as they are here.

    ## Use "Clean URLs".
    $EnablePathInfo = 1;

    $ScriptUrl = "http://staff.washington.edu/UWNetID/pmwiki";

    Make sure to replace staff with the type of account you're using and UWNetID with your UW NetID.

    Your wiki should now have nice, clean URLs.

Authentication Setups

PmWiki can fairly easily be set up to either suggest the UWNetID of a logged-in user for the Author field of an edit or to automatically use the UWNetID in the Author field.

Suggest the UWNetID

  1. First you'll have to enable UWNetID authentication for your PmWiki directory.

    You can do this by following the instructions for Authorizing Any Valid UW NetID.

    Assuming you want anyone with a UWNetID to be able to read your blog, you can use this .htaccess file in your PmWiki directory:

    AuthType UWNetID
    require valid-user
  2. Then you'll have to add a config file to your PmWiki directory. This config file sets the title of the site, requires users who edit pages to provide a name, and writes their UWNetID into the Author field. In this case the user can change the name in the author field, and it should stay set to what they change it to for their session.

    Create a file named config.php in your PmWiki directory with the following contents, adjusted as necessary for your account and purposes.

    <?php if (!defined('PmWiki')) exit();

    # $WikiTitle sets the title of your wiki
    $WikiTitle = 'test wiki';

    # $ScriptUrl is your preferred URL for accessing wiki pages
    $ScriptUrl = 'https://accountType.washington.edu/UWNetID/pmwiki/pmwiki.php';

    # $PubDirUrl is the URL for the pub directory.
    $PubDirUrl = 'https://accountType.washington.edu/UWNetID/pmwiki/pub/';

    # Require an author name.
    $EnablePostAuthorRequired='1';

    # Set $Author to the UWNetID in REMOTE_USER
    if ($action == 'edit') {
      if (@$_SERVER['REMOTE_USER'] && !@$_COOKIE['author']) {
        $Author=@$_SERVER['REMOTE_USER'];
        setcookie('author',$Author,0,'/');
      }
    }
    ?>

Note: accountType should be replaced with staff, faculty, depts, courses, or students. Use whichever of these you normally use to view your website. UWNetID will be replaced with your UWNetID.

Automatically Use the UWNetID

  1. First you'll have to enable UWNetID authentication for your PmWiki directory.

    You can do this by following the instructions for Authorizing Any Valid UW NetID.

    Assuming you want anyone with a UWNetID to be able to read your blog, you can use this .htaccess file in your PmWiki directory:

    AuthType UWNetID
    require valid-user
  2. Then you'll have to add a config file to your PmWiki directory. This config file sets the title of the site, requires users who edit pages to provide a name, and writes their UWNetID into the Author field. The user can change the name in the Author field, but it will just enter their UWNetID anyhow.

    Create a file named config.php in your PmWiki directory with the following contents, adjusted as necessary for your account and purposes.

    <?php if (!defined('PmWiki')) exit();

    # $WikiTitle sets the title of your wiki
    $WikiTitle = 'test wiki';

    # $ScriptUrl is your preferred URL for accessing wiki pages
    $ScriptUrl = 'https://accountType.washington.edu/UWNetID/pmwiki/pmwiki.php';

    # $PubDirUrl is the URL for the pub directory.
    $PubDirUrl = 'https://accountType.washington.edu/UWNetID/pmwiki/pub/';

    # Require an author name.
    $EnablePostAuthorRequired='1';

    # Set $Author to the UWNetID in REMOTE_USER
    if ($action == 'edit') {
      if (@$_SERVER['REMOTE_USER']) {
        $Author=@$_SERVER['REMOTE_USER'];
        setcookie('author',$Author,0,'/');
      }
    }
    ?>

    Note: accountType should be replaced with staff, faculty, depts, courses, or students. Use whichever of these you normally use to view your website. UWNetID will be replaced with your UWNetID.

Other Documentation and Customization