# MediaWiki

MediaWiki is a program that lets you and visitors to your site input information about a subject. If you haven't noticed it we are using it for our support knowledge base (the thing that you are on right now). It's like an on-line encyclopedia. You can visit MediaWiki's website for more details and to see examples of it being used. http://www.mediawiki.org/wiki/MediaWiki

MediaWiki is most well-known for being the software behind Wikipedia. It is also the software that runs this site.

You can use the DreamHost Control Panel to install your own MediaWiki-based wiki. It's under Goodies Control Panel > One-Click Installs. By using the more advanced options, you can make it even more flexible and customizable. There is a little bit of a learning curve, but once you figure out the basics, it can potentially feel like a fairly efficient system to use.

## Getting Started

You can use the DreamHost Control Panel to install your own MediaWiki-based wiki. It's under Goodies Control Panel > One-Click Installs

Basically, you put all mediawiki files in your chosen directory (either via the DreamHost script or by FTP), create a mysql database and user, then point your browser at http://your.install.directory/config where you fill-in a large configuration form.

Execute the form, move the newly generated LocalSettings.php to the parent directory, and delete the config directory with its content.

Troubleshooting

### New extensions 2014

If you get an error message immediately after installing that states:

MediaWiki internal error.
Exception caught inside exception handler.
Set $wgShowExceptionDetails = true; at the bottom of LocalSettings.php to show detailed debugging information. Try the following: Use ## require_once( "$IP/extensions/SimpleAntiSpam/SimpleAntiSpam.php" );
OR
## require_once( "$IP/extensions/TitleBlacklist/TitleBlacklist.php" ); And comment out: ## require_once( "$IP/extensions/Scribunto/Scribunto.php" );

### Older

As of mediawiki 1.8.2 be sure to select "use backward-compatible UTF-8" in the configuration form's mysql section. "UTF-8 experimental" does not work and it causes the install script to fail silently without generating LocalSettings.php . This is mediawiki bug 6085 that depends on buggy MySQL support of UTF-8. See http://bugzilla.wikimedia.org/show_bug.cgi?id=6085

In the MediaWiki 1.8.2 installation process, the configuration form will ask for a "database host" which defaults to "localhost". It seems you must change this to an answer that looks like "mysql.<yourdomain.net>".

An error referring to "require_once" in Setup.php may mean that the global variable $IP refers to a non-existent path (directory), which can happen after a Server Move.$IP is set in LocalSettings.php. Make a backup of it then edit it to remove any directory beginning with a . in $IP. ## Using Tex Markup MediaWiki can use Latex Markup for Mathematics, to use it you must go to your wikiInstallationDirectory/math and run make. To do this, you first must set the user account to Enabling Shell Access, and then login to your account using an SSH shell client. Once logged in, use Unix Commands to navigate yourself to the math directory stated above, and then run the make command. The required executable will then be compiled. Once compilation has compiled, set $wgUseTeX = true; in your LocalSettings.php and then markup like

$\sum_{n=0}^\infty \frac{x^n}{n!}$


will show up as an image in your MediaWiki.

## Permissions

Under the default one-click dreamhost install under Goodies, you CAN set all files and subdirectories under the wiki root directory to group writeable. This is helpful if you want to share administrative/patching and other duties with other accounts in your group. You can use a custom group to scope permissions properly. MediaWiki will still execute just fine with group writeableness turned on.

If you are using Google Analytics, you can easily use it on your wiki. The MediaWiki Google Analytics Integration extension is the best way to do this.

You can also modify MediaWiki directly by changing the MonoBook.php file (or your skin file of choice). Simply insert the text that Google Analytics provides right before the "</body>" at the end of the PHP file. Log into your Google Analytics account to get the correct text. Note that this method will only work for the skins that you modify. If users are allowed to change skins and do so, they will not be tracked.

Alternatively you can add to LocalSettings.php,

$wgHooks['SkinAfterBottomScripts'][] = function ($skin, &$text ) {$text .= HTML::inlineScript( <<<contents
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
contents
);

$text .= HTML::inlineScript( <<<contents try { var pageTracker = _gat._getTracker("UA-4073938-8"); pageTracker._trackPageview(); } catch(err) {} contents ); return true; };  ^ This will add the text that Google Analytics provides to the bottom of all skins ## Google Maps To add google maps to your wiki, install the Google Maps Extension ## MediaWiki licensing When MediaWiki is installed the installer selects the appropriate licensing (usually, GFDL or Creative Commons). Changes to the licensing can be made in LocalSettings.php . See MediaWiki licensing settings for settings and detailed intructions. ## Running maintenance scripts To do this, you must enable command-line access on Dreamhost, then log in vis ssh. Then you must use PHP5: /usr/local/php5/bin/php to run the .php files stored in the maintenance subdir. ## Thumbnail problems MediaWiki may occasionally have problems generating image thumbnails, returning corrupted images or the error message "Error creating thumbnail". There are two common causes of this: ### Not enough memory If you upload a large image and see "Error creating thumbnail" where a thumbnail should be, try adding the following to LocalSettings.php: $wgMaxShellMemory = 524288;


Thanks to Black Gate Publishing for the tip.

### SVG images

The default image processing programs installed do not have good support for generating thumbnails of SVG images. You can work around this by installing librsvg and configuring MediaWiki to use it instead. Note that the installation process is not supported and is recommended only for advanced users.

## Blocking MediaWiki Spam

Around the web, there are many people talking about the problem of wiki spam on MediaWiki, and how to block it.

Some of the more comprehensive resources are:

Mediawiki Anti-spam Features
The official mediawiki anti-spam page. Brief descriptions of the main anti-spam features which you can activate/install. Note that most of these are not activated by default.
\$wgSpamRegex details and examples
An easy MediaWiki configuration setting to get started with. Some examples provided.
Mediawiki Wiki Spam
Description of what wiki spam is, and instructions on how any user can help tackle the wiki-spam problem (not just administrators). Not all of which is obvious, so it's worthwhile for administrators to read through this too, as you might wish to refer your wiki users to this.

## Caching

The configuration DreamHost uses for PHP is not compatible with using XCache as an object cache for MediaWiki. Attempting to enable it results in unreliable behavior (e.g., users in MediaWiki not staying logged in, or edits to pages sometimes not taking effect). XCache does still work as a PHP opcode cache, though. This is sufficient to speed up MediaWiki by quite a bit; the object cache functionality is not crucial.

## Unicode normalization

To use the intl PECL extension for Unicode normalization, put the following in php.ini: extension = intl.so