This tutorial will take you through the steps required to get PhpWiki installed and working on Postgres Plus.
PhpWiki requires that you have an application stack installed and working on your computer, if any of these questions apply to you:
Then you should check out these prerequisites.
When you have a stack installed and active and know what ports it is using, installing PhpWiki is straightforward.
The steps that you will go through will be to:
Download the latest stable version of PhpWiki from here.
You should extract PhpWiki to the C:\PostgresPlus\8.3\apache\htdocs directory and call it phpwiki (i.e. ..\htdocs\phpwiki).
You will end up with a directory structure like the one below when you have finished.
Make sure that your Postgres Plus database is up and running because you need to set up the PhpWiki database and users.
If you need help setting up new database objects (like Users, Database and Tables), here is a quick cheat sheet.
You should go into the database and set up a new user with Superuser privileges, see below.
Then you should create a database to hold your data.
Once you have done this, you need to create the schema that PhpWiki will use. It's easy to do, just copy the script below and paste it into the SQL Tool in pgAdmin III - if you need help with this, here is a quick cheat sheet.
CREATE TABLE wiki (
pagename VARCHAR(100) NOT NULL,
version INT NOT NULL DEFAULT 1,
flags INT NOT NULL DEFAULT 0,
author VARCHAR(100),
lastmodified INT NOT NULL,
created INT NOT NULL,
content TEXT NOT NULL,
refs TEXT,
PRIMARY KEY (pagename)
);
CREATE TABLE archive (
pagename VARCHAR(100) NOT NULL,
version INT NOT NULL DEFAULT 1,
flags INT NOT NULL DEFAULT 0,
author VARCHAR(100),
lastmodified INT NOT NULL,
created INT NOT NULL,
content TEXT NOT NULL,
refs TEXT,
PRIMARY KEY (pagename)
);
CREATE TABLE wikilinks (
frompage VARCHAR(100) NOT NULL,
topage VARCHAR(100) NOT NULL,
PRIMARY KEY (frompage, topage)
);
CREATE TABLE hottopics (
pagename VARCHAR(100) NOT NULL,
lastmodified INT NOT NULL,
PRIMARY KEY (pagename, lastmodified)
);
CREATE TABLE hitcount (
pagename VARCHAR(100) NOT NULL,
hits INT NOT NULL DEFAULT 0,
PRIMARY KEY (pagename)
);
CREATE TABLE wikiscore (
pagename VARCHAR(100) NOT NULL,
score INT NOT NULL DEFAULT 0,
PRIMARY KEY (pagename)
);
Next, you have to edit the config.php file in the C:\PostgresPlus\8.3\apache\htdocs\phpwiki\lib directory.
You'll need to make 2 edits, the first is that you need to change the variable WhichDatabase from 'default' to 'pgsql'. It's easy to do, just search for the comment box labeled Part Two: Database section, and edit the line that says $WhichDatabase =
/////////////////////////////////////////////////////////////////////
// Part Two:
// Database section
// set your database here and edit the according section below.
// For PHP 4.0.4 and later you must use "dba" if you are using
// DBM files for storage. "dbm" uses the older deprecated interface.
// The option 'default' will choose either dbm or dba, depending on
// the version of PHP you are running.
/////////////////////////////////////////////////////////////////////
$WhichDatabase = 'pgsql'; // use one of "dbm", "dba", "mysql",
// "pgsql", "msql", "mssql", or "file"
The second edit is that you have to tell PhpWiki how to connect to this database. Again, this is easy, you simply enter the information that you used to create the database and user earlier.
// PostgreSQL settings -- see INSTALL.pgsql for more details
} elseif ($WhichDatabase == 'pgsql') {
$pg_dbhost = "localhost";
$pg_dbport = "5432";
$pg_dbuser = "phpwiki"; // username as used in step 2 of INSTALL.mysql
$pg_dbpass = "*******"; // password of above user
$WikiDataBase = "wiki"; // name of the database in Postgresql
$WikiPageStore = "wiki";
$ArchivePageStore = "archive";
$WikiLinksPageStore = "wikilinks";
$HotTopicsPageStore = "hottopics";
$HitCountPageStore = "hitcount";
include "lib/pgsql.php";
In your web browser, go to http://localhost:8080/phpwiki (Use the port number you have Apache configured on).
You'll see this screen:
When you click on the Front Page link, you'll see this:
That's it, you now have PhpWiki up and running on Postgres Plus!