Difference between revisions of "MediaWikiLite"

From Organic Design wiki
(successful windows standalone nonoweb/php combo)
m (Running one Windows without installation)
Line 65: Line 65:
  
 
ConfigDir        = c:\MyWiki\nanoweb\conf
 
ConfigDir        = c:\MyWiki\nanoweb\conf
 +
TempDir          = c:\MyWiki\nanoweb\tmp
 
PidFile          = c:\MyWiki\nanoweb\nanoweb.pid
 
PidFile          = c:\MyWiki\nanoweb\nanoweb.pid
 
MimeTypes        = c:\MyWiki\nanoweb\conf\mime.types
 
MimeTypes        = c:\MyWiki\nanoweb\conf\mime.types
Line 92: Line 93:
 
ParseExt          = php CGI c:\MyWiki\php\php-cgi.exe
 
ParseExt          = php CGI c:\MyWiki\php\php-cgi.exe
 
ParseExt          = exe CGI $SCRIPT_FILENAME
 
ParseExt          = exe CGI $SCRIPT_FILENAME
 
TempDir          = c:\MyWiki\nanoweb\tmp
 
 
IgnoreDotFiles    = 1
 
IgnoreDotFiles    = 1
 
AllowPathInfo    = 1
 
AllowPathInfo    = 1
Line 104: Line 103:
 
LoadModule        = mod_load_limit.php
 
LoadModule        = mod_load_limit.php
 
LoadLimit        = 8.0
 
LoadLimit        = 8.0
LoadLimitAction = error
+
LoadLimitAction   = error
LoadLimitError = 503
+
LoadLimitError   = 503
 
LoadLimitErrorMessage = Server load is too high (<b>%CUR_LOAD/%MAX_LOAD</b>), try again in a few moments.
 
LoadLimitErrorMessage = Server load is too high (<b>%CUR_LOAD/%MAX_LOAD</b>), try again in a few moments.
  

Revision as of 10:40, 28 May 2010

The idea of MediaWikiLite is to allow the current MediaWiki codebase to run as a standalone server without requiring a database server or web-server. This forms the foundation for a number of alternative uses for the MediaWiki software in environments where the current LAMP architecture is too resource intensive.

There are a number of personal desktop wiki's out there, but they do not use the MediaWiki parser, and making a fork of the parser code defeats the purpose. Also, embedded devices such as PDA's, iPod's and iPhone's can only run lite applications effectively and getting MediaWiki onto them would be very useful, especially if it could synchronise with a web-based mirror when an internet connection becomes available.

A lite version of MediaWiki would make a possible candidate for a client side wiki interface to a P2P article space, i.e. a decentralised Wikipedia or PeerPedia.

Removing the web and database servers

As of version 1.13, MediaWiki natively supports the SQLite database which is a program library compiled in to PHP instead of running as a separate server outside of the PHP environment. A running instance of MediaWiki 1.15.1 using the SQLite database can be seen at mediawikilite.org to test the current functionality.

To remove the need of an external web-server such as Apache or IIS, we're using NanoWeb which is a web-server entirely written entirely in PHP and comes with a number of modules such as a mod-rewrite clone for friendly URL's. It can execute CGI scripts using a normal CGI module or a FastCGI module.

Proposed portable folder structure

Ideally this would be able to run without requiring any installation into the system, so that each personal wiki would be a folder containing the wikis SQLite content and the executable codebase that could be run from memory stick and taken from machine to machine without altering the machine in any permanent way.

The folder structure of a typical MediaWikiLite would be something like this:

The portable wiki's folder contains its own web server and a MediaWiki codebase. In its root there is a startup program made for each OS which has platform specific means of running a compiled MediaWikiLite (or a standalone PHP interpreter). The folder also contains the .sqlite data file containing all the content of the wiki.

Running multiple wiki's

Since there could be any number of these portable-wiki-folders we'd often want to run a number of them at once, but it would not be efficient or practical to have multiple instances of the NanoWeb server running on different ports, especially since they all use similarly named DLL's. It would be better if the wiki startup script were able to detect if an instance of NanoWeb were already running and if so create a new virtual host entry in the existing instance for the new wiki.

Current state

So far I've confirmed that the current version (1.15.3) of MediaWiki is able to run using the SQLite database and the NanoWeb PHP webserver on Ubuntu Linux. This is not running in a self-contained way though since PHP5 was installed the usual way and NanoWeb was installed from the Ubuntu APT repository. It does however illustrate that they are all able to operate happily together and furthermore article reads, edits, preference settings and special pages all came up very responsively. The next test is to do the same on Windows, I'm told that it's much less efficient on Windows due to the lack of PHP threading, but I'm hoping this problem only applies when trying to serve pages to multiple clients.

Development notes

SQLite Installation

Currently we don't have a self-contained folder structure that MediaWikiLite's can run out of, so you'll need to ensure that SQLite is installed into the PHP environment properly. It's important to use SQLite3 rather than 2 because the former supports more similar syntax for some SQL such as table creation. Aside from that, version 3 uses more compact files and executes more efficiently because it works via PHP's PDO functions.

  • To install SQLite3 on a Debian based system, use apt-get install php5-sqlite3.
  • Check your phpinfo() to see if pdo_sqlite is listed, if not, try adding extension=php_pdo_sqlite.so into the dynamic extensions section of your php.ini

Running one Windows without installation

I've successfully created a self-contained folder structure containing NanoWeb and PHP which is able to be run from the command line without any changes to the OS. My test folder structure was C:\MyWiki and required config files to be created for both applications which I placed into the root of each (C:\MyWiki\nanoweb and C:\MyWiki\php). In the case of php.ini the only change required was to enable some extensions as follows:

extension=php_pdo.dll
extension=php_pdo_sqlite.dll
extension=php_sockets.dll

The NanoWeb configuration is a minimal file based on the nanoweb-win.conf sample that ships with it, and required numerous absolute path definitions so the startup script will need to create the nanoweb.conf configuration at runtime. Here's the successful configuration:

ServerMode        = standalone
SingleProcessMode = 1
ListenInterface   = 0.0.0.0
ListenPort        = 80
ListenQueue       = 20

ConfigDir         = c:\MyWiki\nanoweb\conf
TempDir           = c:\MyWiki\nanoweb\tmp
PidFile           = c:\MyWiki\nanoweb\nanoweb.pid
MimeTypes         = c:\MyWiki\nanoweb\conf\mime.types
ServerLog         = c:\MyWiki\nanoweb\log\server.log default
ServerLog         = c:\MyWiki\nanoweb\log\error.log warning+error
LogDir            = c:\MyWiki\nanoweb\log
Log               = access.log
LoggerProcess     = 0

DocumentRoot      = c:\MyWiki\mediawiki
DirectoryIndex    = index.php

KeepAlive         = 0
RequestTimeout    = 15
ChildLifeTime     = 21600

DefaultContentType = text/plain
HostnameLookups   = 1
HostnameLookupsBy = server
LoadTheme         = default.theme
ServerTheme       = default
ServerName        = localhost
ServerAdmin       = root@localhost
ServerSignature   = min

DefaultHandler    = static
ParseExt          = php CGI c:\MyWiki\php\php-cgi.exe
ParseExt          = exe CGI $SCRIPT_FILENAME
IgnoreDotFiles    = 1
AllowPathInfo     = 1
PathInfoTryExt    = php

ModulesDir        = C:\MyWiki\nanoweb\modules\
LoadModule        = mod_static.php
LoadModule        = mod_cgi.php

LoadModule        = mod_load_limit.php
LoadLimit         = 8.0
LoadLimitAction   = error
LoadLimitError    = 503
LoadLimitErrorMessage = Server load is too high (<b>%CUR_LOAD/%MAX_LOAD</b>), try again in a few moments.

LoadModule        = mod_pfilters.php
FilterEnable      = 1

LoadModule        = mod_gzip.php
GzipMaxRatio      = 90
GzipLevel         = 5

See also