Setting up XAMPP
I wanted a personal wiki hosted locally. Hence I needed to set up a WAMP (Windows-based Apache, MySQL, PHP stack) to host MediaWiki on my computer. I got XAMPP: there are millions of downloads.
After downloading and installing, I took the following extra steps:
- Started Apache and MySQL as services. (I don't need any of the others.) Clicking the SCM button in the XAMPP control panel brings up the Services Management Console (they should have a tooltip on that button) to check that Apache and MySQL services have start-up type of Automatic. This is to have them start up whenever the system starts.
- Went to http://localhost/security to set up a MySQL root password, phpMyAdmin password and
.htaccessprotection for the XAMPP configuration pages — all via a web interface.
XAMPP/php/php.infoedited the timezone value to read
date.timezone = "Australia/Perth"
Also set the script execution timeout to 10 minutes, to allow me to import a database (this takes a long time).
max_execution_time = 600
(Note: still couldn't import SQL database dump via phpMyAdmin after changing this setting, Firefox said "The connection was reset" after a fairly short while. See next section for the solution.)
XAMPP/mysql/bin/my.iniedited the timezone value also
default-time-zone = "+08:00"
- Restarted Apache and MySQL services.
That was it.
I also wanted to restore an old MediaWiki installation that we had a backup of.
First I made the user
wikiuse and database
wikidb through phpMyAdmin. Then I granted all privileges for that user on that database.
The easiest way to import a file would have been through phpMyAdmin, but that didn't work. (For an alternative solution see this page.) So I pressed the Shell button in the XAMPP control panel, typed in
mysql -u wikiuse -p
Gave the password when it asked for it.
mysql> use wikidb mysql> source C:/Downloads/backup_10_10_2010.sql
Then I could look at the database through phpMyAdmin.
Hitting a snag
MediaWiki refuses to install itself, because the latest version of XAMPP, 1.7.3, includes a buggy version of PHP: 5.3.1.
Note: this section is no longer relevant, as XAMPP now has a more up-to-date PHP.
I downloaded a threadsafe x86 version of PHP 5.3.2 compiled with VC6, and, after looking at
install.txt in that package, stopped Apache and MySQL, and just unzipped the PHP distribution into
XAMPP/php/, overwriting various files. (Made a backup copy of the directory beforehand.)
Started up Apache and MySQL. It seemed to work ok.
Restoring an old instance of MediaWiki
I untarred the latest version of MediaWiki into
XAMPP/htdocs/w/, then ran the configuration, specifying the database user and password, and prefix to match the restored database.
The installation script worked it all out automatically: updated the database schema and did a lot of other stuff. And then I could see the old wiki!
Browsing MediaWiki contents through phpMyAdmin or another client
Other clients I know are the command-line
mysql prompt interface and MySQL Query Browser.
page stores the titles of pages, table
revision stores revisions and table
text stores their actual content. The field
page.page_latest links to
revision.rev_text_id links to
text.old_id, where you get the text. Follow these links. With phpMyAdmin, you have to click "+Options" and select "Show BLOB contents" to read the text.
Making another instance of MediaWiki
All I had to do was rename
LocalSettings.php, create a new database and database user (or I could have just used a different prefix), and go to
To switch back to the other instance, I just switch
LocalSettings.php by renaming the file.