MediaWiki FAQ

From Meta, a Wikimedia project coordination wiki

Jump to: navigation, search

NOTE: this page is being replaced by the FAQ at MediaWiki.org. If your question isn't in here, look there.

Contents


[edit] In general

[edit] Are "Wikimedia" and "MediaWiki" the same thing?

No. Wikimedia is the name of a group of wiki-based open-content projects managed by the non-profit Wikimedia Foundation. MediaWiki is the underlying software interface of these collaborative projects.

For further clarification, see our article on the names.

[edit] I tried that but it didn't work

I had a problem, I came to this page and it told me how to fix it. But it didn't work, the problem is still there!

Nine times out of ten this is because you didn't clear your cache. The simple test for this is to request a page that hasn't been requested before. Select the part of the URL in the address bar that contains the page title (e.g. Main_Page). Twiddle your fingers on the keyboard for a while, hit enter. Check if the problem is on that page too.

MediaWiki uses both a server-side cache and a client-side cache, so clearing your browser cache is often not enough. See the relevant entry below for more details.

Here are some other things to check:

  • Were you editing the right file? Try inserting some garbage into the file you edited, does it break anything?
    • A great debugging tool in this case is to create a file called phpinfo.php, containing only <?php phpinfo() ?> . Upload it into your web directory and invoke it with your browser. Check the document root and the path to php.ini.
  • Were you editing the right part of the file? Did you create a duplicate entry in php.ini? Add new settings to the end of LocalSettings.php (but before the ?>), not to the beginning.
  • If you created a .htaccess, are you sure AllowOverrides is on? Ask your hosting provider.

If none of these things work, see the two entries below on how to get more help.

[edit] Where should I post my bug report/feature request?

Please post all bug reports and feature requests at http://bugzilla.wikimedia.org. Please search through existing entries beforehand, to check that the problem isn't fixed in a newer release version of the software, and to ensure we don't have duplicate entries.

[edit] I have a question not answered in this FAQ. Where should I ask it?

You can either

  1. Email the mediawiki-l mailing list, or
  2. Ask in our IRC channel

[edit] Installation

See also:

[edit] How do I install MediaWiki? What are the system requirements?

See Help:Installation

[edit] Is it possible to install more than one wiki (MediaWiki) on a server? How?

Yes, MediaWiki can be installed multiple times in different directories using either the same database with a different set of table prefixes (configurable upon install) or using different databases altogether.

Additionally, you may want to make some settings common for all the installations, and have a central place where changes to these can be made. Since the configuration file (LocalSettings.php) is executed as PHP code, this can be done with PHP's inclusion mechanism - for instance, by adding the line include_once("../CommonSettings.php") in each LocalSettings.php, and placing settings which apply to all wikis in ../CommonSettings.php.

If you have a large number of wikis on one host, you may not want to keep a separate copy of the source code for every one. Instead, extract the source somewhere, and for each wiki installation, symlink the entire MediaWiki directory with the sole exception of the LocalSettings.php file. This can be accomplished with the lndir command (available on some Linux installations) or an equivalent tool.

You can then either use a separate LocalSettings.php for each wiki, or (easier to maintain) determine the settings based on the URL. See also Wiki farm.

If you want your login to be persistent across Wiki's running on the same server, simply add the following line to your LocalSettings.php after $wgSiteName = ... :

ini_set("session.name", "{$wgSitename}Session" );

(Though you can expect some trouble if $wgSiteName contains spaces. In that case replace {$wgSiteName} with an explicit space-removed version). $wgSecretKey (or deprecated $wgProxyKey) must be the same across your wikis for persistent logins to work.

Have a look at http://www.mediawiki.org/wiki/Manual:Wiki_family

[edit] How to install more than one wiki on a single server, using the same source code, and using the same database (v1.5.1, May 2006)

Here is how to install the Mediawiki software just once, but use it to power more than one wiki, keeping the tables for all the wikis in a single database-- including step-by-step instructions for a Unix-type of installation. This solution should work for most shared-hosting servers, too. Level of difficulty: Novice. See the instuctions here http://www.steverumberg.com/wiki/index.php/WikiHelp Srumberg

[edit] How to have 3 wikis use the same user information, but otherwise have separate databases and files

I have three Wiki installs that are each separate, but on the same server. Their DBs are on the same mySQL server, but are in different databases. How do I make them all share the user information (and allow cross-site logins, so that if someone logs into site 1, they are also logged into site 2)? Can this be done by designating one user table as a master, and the others as views to that master? Any other possibilities?

[edit] How do I install more than one Wiki-Server with SSL on Windows? (March 2006)

  • Installed Mar 2006, W2K3-Server, Apache 2.0.54, PHP5.04 (xampp-win32-1.4.14), MediaWiki 1.5.6
Solution : Shared VirtualHost with SSL, one IP-Address, one SSL-Certificate 


  • 1. Install MediaWiki
e.g. 2 Wiki-Server, installed in real DocumentRoot, 
first in /DocumentRoot/wiki1 
second in /DocumentRoot/wiki2
  • 2. Rename index.php and add entries (alias, ...) to httpd.conf
Rename index.php e.g. in wiki1ix.php and wiki2ix.php
# GLOBAL AREA httpd.conf
# First Wiki-Server 
Alias /wikisrv1 /DocumentRoot/wiki1/wiki1ix.php
Alias /wiki1ix.php /DocumentRoot/wiki1/wiki1ix.php
# Alias for upload-area
Alias /uploads /DocumentRoot/wiki1/uploads
# Second Wiki-Server 
Alias /wikisrv2 /DocumentRoot/wiki1/wiki2ix.php
Alias /wiki2ix.php /DocumentRoot/wiki2/wiki2ix.php
# Alias for upload-area
Alias /uploads /DocumentRoot/wiki2/uploads
# VIRTUALHOST AREA httpd.conf
<VirtualHost 111.111.111.111:80>
   ServerName www.domain.de
   ServerAdmin ...
   # Real DocumentRoot !
   DocumentRoot "/DocumentRoot"
   ErrorLog ...
   CustomLog ...
 ...
   # Wiki-Server 
   DirectoryIndex wiki1ix.php wiki2ix.php
 ...
   AccessFileName .htaccess
 ...
   ScriptAlias /php/ "/xampp/php/"
   Action application/x-httpd-php "/php/php.exe"
 ...    
</VirtualHost>
  • 3. Settings in LocalSettings.php
$IP = "/DocumentRoot/wiki1";
...
$wgScriptPath     = "/wiki1";
$wgScript           = "$wgScriptPath/wiki1ix.php";
...
$wgArticlePath = "/wikisrv1/$1";
(wiki2 too)
  • 4. Settings in .htaccess /DocumentRoot/wiki1
# RewriteRule SSL
RewriteEngine On
RewriteRule ^/$ /wiki1ix.php
RewriteCond %{SERVER_PORT} !443$
RewriteRule ^(.*) https://www.domain.de/$1 [R=301,L]
(wiki2 too)
  • 5. Optional Settings in .htaccess /DocumentRoot
# deny access to Root Directory, rewrite to another virtual host 
RewriteEngine On
RewriteRule ^/$ /index.html
RewriteRule ^(.*) http://www.domain.de/othervhost/
# if Alias-Directory upload is indexed, rewrite home-link back to wiki-server
RewriteCond %{HTTP_REFERER} https://www.domain.de/uploads/
RewriteRule ^(.*) https://www.domain.de/wikisrv1/InformationDirectoryPage

[edit] Can I import from other types of wiki?

There is some documentation about importing in the UPGRADE file distributed with MediaWiki.

To follow on from those, this is how at least one individual imported pages from usemod to MediaWiki:

Because MediaWiki does not automatically link to CamelCase style links, you will need to add brackets [[ ]] to all your links. You can do this with the following:

First, obtain ImportStage1.txt (or whatever you want to call it) from the importUseModWiki.php script ( use > to pipe the output to a file )

Second, do

sed '/Importing/!s/\ [A-Z]\w*[a-z]\w*[A-Z]\w*[a-zA-Z]/\ \[\[&\]\] /g'
    ImportStage1.txt > ImportStage2.txt

This should create proper links in place of your CamelCase links.

This doesn't work so well for SubPage links - someone care to fix?

Then,

sed 's/upload\:\w*\.\w*/http\:\/\/aberwiki\.org\/uploads\/& /g'
    ImportStage2.txt > ImportStage3.txt

This fixes your upload links. Change the replace text so it fills in your url such as http://www.yourwiki.org/uploads/filename

You are now ready to import ImportStage3.txt into your database with a command such as

mysql -u<mysqluser> -p<yourpass> <db name> < ImportStage3.txt

Note: If your importUseModWiki.php outputs an XML file instead of SQL statements, this probably means you have a rather new version of MediaWiki. In such a case, you case import the XML file -- see Importing a Wikipedia database dump into MediaWiki, towards the bottom of the page ('Import XML'). Don't forget to rebuild all the tables -- that page also explains how to do that.

[edit] Is it possible to define a database prefix?

It is not possible in versions 1.3.x and prior.

In versions 1.4 and later it is possible to configure a database prefix during the install process. It is a good practice to add an _ after the prefix otherwise all the tables will look really clumsy.

[edit] Why is the Help: namespace empty?

We don't currently have a clean, generic, internationalized set of help pages. Would you like to write one? However, you will find some useful pages in the MediaWiki User's Guide. They are of course open content under the GNU FDL.

[edit] I've changed $wgLanguageCode to something else, but nothing happens - what gives?

MediaWiki will look for interface text in a special namespace, MediaWiki. These messages can be viewed through Special:Allmessages. Changes to $wgLanguageCode post-install will not be reflected in the interface using the default configuration.

To permit the changes to take effect, either:

  • Run the rebuildMessages.php script from the command line in /maintenance folder
php rebuildMessages.php --rebuild

OR

Note: Using the second option will disable the MediaWiki namespace for the purposes of customizing the interface, including items such as the sidebar.

Note 2: The language settings are also influenced by the user's preferences at Special:Preferences. If you change the language of your wiki, it is possible the old messages still appear because your "Language" field at the user-preferences is still set at the old language. -- Wilinckx 17:05, 10 March 2006 (UTC)

[edit] What if I can't run rebuild Messages.php from the command line?

If you don't have access to a shell/command line (usually the case with third party hosting services) then you may find you can use Martin Geisler's phpShell software to achieve the desired result (unless SAFE MODE is not set for php).

For more information, visit http://mgeisler.net/php-shell.

[edit] The install stops with no messages or I get a blank page!

Installation problems are sometimes weird and hard to diagnose. If possible, check PHP's error log (you may have to configure PHP to enable error logging) and report any error messages you have and the complete output from the installation script to mediawiki-l, we'll see if we can hash it out.

If you can track down the problem specifically, please report it directly to http://bugzilla.wikipedia.org/

Known issues

  • Version 1.3.3: you'll get a blank page after submitting configuration info on your config/index.php script if you don't make the config directory writeable.
  • Version 1.3.x: bugzilla:736

[edit] I want my wiki to appear in a frame as part of my site, but it keeps popping out of the frame

MediaWiki contains protection against abusive use of frame sets. Unfortunately this will trap your intentional frames as well -- to remove this, edit stylesheets/wikibits.js and remove these lines:

(Please note that if the wikibits.js file isn't in stylesheets/wikibits.js it may be skins/common/wikibits.js)

 // Un-trap us from framesets
 if( window.top != window ) window.top.location = window.location;

This may not work with MediaWiki: 1.5.8. I tried this with 1.5.8. The path was /skins/common/wikibits.js. But it still keeps popping out. Must be something else somewhere else involved as well?195.82.106.244 14:47, 14 April 2006 (UTC)
This doesn't work for 1.6.9. Still no solution?

[edit] How do I change messages of the user interface?

The user interface text is put into pages in the special MediaWiki namespace. When logged in as a sysop, you can edit those pages to immediately change the output of the wiki.

Some configuration changes (like changing $wgSitename to set the wiki's name) don't affect the pages which were generated at install time. You can edit them directly, or use the "rebuildMessages.php" script in the maintenance directory (it must be run from the command line and you must set up an AdminSettings.php file). See MediaWiki localisation.

[edit] Why doesn't my wiki work on Sourceforge?

See Running MediaWiki on Sourceforge.net.

[edit] How do I install Imagemagick for Thumbnails on Windows?

With the following installed on the server, it should work:

  • php.ini
extension=php_imagick.dll
  • Localsettings.php
$wgEnableUploads = true;
$wgUseImageResize = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "convert"; #<-- this should point on the right path 

If its in the windows path variable, you can use "convert" only


Using ImageMagick-6.2.5-Q16-windows-dll:

  • Install ImageMagick. Make sure the installation directory does not contain any blank spaces.
  • LocalSettings.php
$wgEnableUploads = true;
$wgUseImageResize = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "convert";  # <-- this should point on the right path
  • You don't have to add php_imagick.dll to your php.ini
  • If you are running php in safe mode, add the ImageMagick installation directory to your php.ini: e.g safe_mode_exec_dir=C:/Programs/ImageMagick.
  • Also you will have to change permissions for %systemroot%/system32/cmd.exe. Grant read and execute rights to IUSR_XXX and IWAM_XXX.


Using ImageMagick-6.3.3-Q8:

  • I installed the DLL version on our server.
  • In LocalSetting.php
    • I set $wgUseImageMagick = true;
    • I set $wgImageMagickConvertCommand = "The appropriate file path" (in quotes) WITH spaces.
  • Everything worked fine.

[edit] How do I install Imagemagick for Thumbnails on Windows? (March 2006)

  • Installed Mar 2006, W2K3-Server, Apache 2.0.54, PHP5.04 (xampp-win32-1.4.14), MediaWiki 1.5.6
  • 1. Installation - ImageMagick
- Download from http://www.imagemagick.org/download/www/binary-releases.html 
- or look at http://www.imagemagick.org/download/binaries/
- DLL-version ImageMagick-6.2.6-1-Q8-windows-dll.exe 
- e.g. install in e:\usr\bin\sysexec (do not use any space in the install path)
  (no 'Program Files' allowed nor 'progra~1')
- set PATH to e:\usr\bin\sysexec (normally, this is automatically done during installation)
  • 2. Environment - LocalSettings.php :
NOT THIS FOR $IP : $IP = "E:\\xampp\\htdocs\\mediawiki"; 
MUST BE WITH SLASH : $IP = "/xampp/htdocs/mediawiki";
$wgEnableUploads = true;
$wgUseImageResize = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "convert.exe";
  • 3. PHP safe_mode - httpd.conf (global or virtual host)
php_admin_flag engine on
php_admin_flag safe_mode on
php_admin_value safe_mode_exec_dir /usr/bin/sysexec
  • 4. Modify MediaWiki-PHP-Script includes/Image.php
// SHELL_EXEC COULDN'T EXECUTE WITH PHP-SAFE_MODE ON - USE EXEC !
function reallyRenderThumb( $thumbPath, $width, $height ) {
...
-REMOVE // wfEscapeShellArg( $this->imagePath ),
+ADD ( $this->imagePath ),
-REMOVE // wfEscapeShellArg( $thumbPath ) ),
+ADD ( $thumbPath ) ),
...
-REMOVE // $conv = shell_exec( $cmd );
+ADD // php safe_mode on - set shell_exec to exec
+ADD $conv = exec( $cmd );
...
-REMOVE // wfEscapeShellArg($this->imagePath) . " " .
+ADD ($this->imagePath) . " " .
-REMOVE // wfEscapeShellArg($thumbPath);
+ADD ($thumbPath);
...
-REMOVE // $conv = shell_exec( $cmd );
+ADD         // php safe_mode on - set shell_exec to exec
+ADD         $conv = exec( $cmd );
...

[edit] The index redirects to localhost or 127.0.0.1 or just times out

When constructing full URLs and HTTP redirects, MediaWiki uses the hostname provided by the web server. Under Apache this will usually be specified by the ServerName directive if not autodetected from the system.

If that is set wrong, you should do one of the following:

  • Set the ServerName directive in Apache to the proper hostname
  • Override $wgServer in LocalSettings.php with the URL protocol and hostname (eg 'http://example.com')

[edit] How do I rename a page and all (some) of the links to it?

Pages may be renamed by any logged-in user, in the standard configuration. Using the "move" tab (in monobook skin) a user may enter a new name for a page. A radio-box will allow the talk page to be moved simultaneously to the new talk page. This will also create a redirect to the new name at the old page name.

It's important to check the [[Special:Whatlinkshere]] at the new page name to check for broken redirects and links. Any link which has more than one redirect will "break", leaving the browser looking at the wrong page.

[edit] How do I add a table of contents?

A TOC is added automatically as soon as you have more than three headers. To add one with fewer than four headers, type __FORCETOC__ anywhere on the page or __TOC__ at the position where you want to have the TOC.

To remove a table of contents from a page, add __NOTOC__ to anywhere on the page. The __ character before the commands is two _ characters together See Help:Section for more information.

[edit] MediaWiki is slow, how can I make it faster?

  • First you should try installing a free PHP cache engine such as eAccelerator or APC (after installing, modify your $wgMainCacheType accordingly). The engine will save the parsed PHP scripts and enhance performance a lot (this is something you should use anyway on any PHP installation with non-trivial traffic). Proprietary Zend Platform also contains a bytecode cache, however its "dynamic content caching" is not supported in MediaWiki at the current time.
  • Use Squid or MediaWiki's native file cache ($wgUseFileCache = true) to cache whole pages
  • Memcached will provide some performance benefit, especially for heavily viewed sites. See also the cache section of the configuration settings.
  • See the Reduction section of the configuration setting.
  • See the $wgUseDatabaseMessages setting.
  • Switching the MySQL table type to MyISAM may be faster for single-user wikis on lower-end computers. See also: MySQL Storage Comparison.
  • Disable ImageMagick in LocalSettings.php $wgUseImageMagick, though this will cause reduced thumbnail quality. ImageMagick imposes a performance penalty during various page views and edits and can slow down bulk uploads.
  • For a heavy concurrent write load, InnoDB is essential. Set $wgAntiLockFlags = ALF_NO_LINK_LOCK | ALF_NO_BLOCK_LOCK to reduce lock contention, at the expense of introducing occasional inconsistencies. Use memcached not the default MySQL-based object cache.
  • If using Squid, enable HTCP and add $wgHTCPMulticastAddress
  • If you have $wgReadOnly set, check bug 11533.

[edit] Can I print out my entire MediaWiki site?

Go to PDF Export, export your whole site into one PDF file and print that. Requires HTMLDOC.

[edit] What is the print-friendly url?

Normally the print stylesheet is attached so it is automatically used when printing -- just printing or print-previewing a wiki page will demonstrate this.

You can force a print friendly view. For example:

http://en.wikipedia.org/w/wiki.phtml?printable=yes&title=Main_Page

[edit] Can I use commons.wikimedia.org in my installed version of mediawiki?

Yes, see mw:Manual:$wgForeignFileRepos, although this is discouraged.

[edit] If I start my own commons wiki, how do I set it up, so that my other wikis can use its media?

Have a look at mw:Help:Configuration settings#Shared_uploads or Help:Wiki family for detailed information --Produnis 09:50, 16 April 2006 (UTC)

[edit] How do I run a bot?

You might want to use the python wikipediabot.

[edit] How do I completely disable caching?

Add in your LocalSettings.php file the following lines:

$wgEnableParserCache = false;
$wgCachePages = false;

[edit] How do I purge cached pages?

  1. You can use ?action=purge on individual pages to update their cache dates.
  2. There is a global $wgCacheEpoch variable which can be set in LocalSettings.php to invalidate all prior cache entries (see DefaultSettings.php)
  3. If you want to purge all pages in the parser cache, truncate objectcache table from the wiki database. You may use this command:
    TRUNCATE TABLE objectcache;
    
    Hint: If this fails, you might be using a prefix for your database tables!
  4. A shell script such as this may be used
#! /bin/bash
# mwpurgecache - invalidate mediawiki cache

set -e

PROG=$(basename $0)
VER=0.1

function version() {
 echo "$PROG $VER - invalidate mediawiki cache
Copyright (c) 2005 Claudio Jolowicz <claudio@jolowicz.com>

Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This programs comes with
ABSOLUTELY NO WARRANTEE.
"
}

function usage() {
 version
 echo "Syntax: $PROG [options] [--] [pages]

Options:

 -H, --host          host name           (default: localhost)
 -w, --wiki WIKI     server path to wiki (default: /wiki/)
 -u, --user USER     username for HTTP authentication
 -p, --passwd PASS   password for HTTP authentication
 -d, --dryrun        show commands without executing them
 -q, --quiet         quiet (no output)
 -v, --verbose       be verbose (print server response)
 -h, --help          display this message
 -V, --version       display version information

Options and arguments must be separated by whitespace.  WIKI must
match wgArticlePath, such that \$wgArticlePath = \"WIKI/\$1\". WIKI
must not contain regex special characters.

This script requests all wiki pages listed on the command line by
HTTP, prefixed by the wiki path, appending \`?action=purge' to the
URL. If no pages are specified, it retrieves the list of all pages
from Special:Allpages.

Examples:

 \$ $PROG Main_page Help:Contents
 \$ $PROG -H wiki.my.org -w /mediawiki -u joe -p banana
 \$ $PROG -H wiki.my.org --dryrun | wc -l
"
}

## The '-e#' is a noop option to avoid `Unsupported scheme' errors.
user='-e#'
passwd='-e#'
run=
verbose=-nv
quiet='-e#'

opt_host=http://localhost
opt_wiki=/wiki/
opt_user=
opt_passwd=
opt_dryrun=false
opt_quiet=false
opt_verbose=false
while [ "$1" ]
do
 case "$1" in
   -H|--host) opt_host="$2"; shift;;
   -w|--wiki) opt_wiki="$2"; shift;;
   -u|--user) opt_user="$2"; shift;;
   -p|--passwd) opt_passwd="$2"; shift;;
   -d|--dryrun) opt_dryrun=true;;
   -q|--quiet) opt_quiet=true;;
   -v|--verbose) opt_verbose=true;;
   -h|--help) usage; exit 0;;
   -V|--version) version; exit 0;;
   --) shift; break;;
   -*) usage 2>&1; exit 1;;
   *) break;;
 esac
 shift
done
opt_host=${opt_host%/}
opt_wiki=/${opt_wiki#/}
opt_wiki=${opt_wiki%/}/
[ x"$opt_user" = x"" ] || user="--http-user=${opt_user}"
[ x"$opt_passwd" = x"" ] || passwd="--http-passwd=${opt_passwd}"
$opt_dryrun && run=echo
$opt_verbose && verbose="--server-response"
$opt_quiet && quiet="-q"
(
 if [ $# -eq 0 ]; then
   wget -qO- "$user" "$passwd" "${opt_host}${opt_wiki}Special:Allpages" |
   sed -re '/start content/,/end content/p' -e 's/href="([^"]+)"/\nGREPME:\1\n/g' |
   sed -nre 's/^GREPME:(.*)$/\1/p' |
   grep "^${opt_wiki}"
 else
   for page; do echo "${opt_wiki}${page}"; done
 fi
) |
while read page
do
 $run wget -O/dev/null "$user" "$passwd" "$quiet" "$verbose" "${opt_host}${page}?action=purge"
done

exit 0

[edit] How do I organize pages into subdirectories like /wiki/subdir/PageName?

See Help:Link#Subpage_feature.

[edit] How do I make interlanguage links work, like they do on Wikipedia?

The interlanguage link feature on Wikipedia presents links in the sidebar when the user types text such as [[fr:Accueil]]. This feature is strongly biased towards a multi-wiki setup, with one language per wiki. It's not recommended for the case where multiple languages are contained on the same wiki.

If you're still sure you want to use it, here's how it works: a link such as [[xx:Pagename]] will be considered an interlanguage link if the following three conditions are satisfied:

  1. $wgInterwikiMagic is enabled (which it is by default)
  2. xx is listed as a language code in languages/Names.php (which most ISO 639-2 codes are)
  3. xx is listed as an interwiki prefix in the interwiki table of the wiki database.

To add an interwiki prefix, edit the interwiki table using your favourite MySQL administration tool, or run a query such as:

INSERT INTO interwiki (iw_prefix,iw_url) VALUES ('xx', 'http://xx.mysite.com/wiki/$1');

If you want to have multiple languages on the same wiki, it's better to use templates and subpages, like we do on meta. See m:Wikimedia Foundation for an example of this.

[edit] Search returns no results for some words!

MySQL's fulltext search engine has a default set of stop words which it ignores, and a minimum word length set to 4 characters by default.

To change this you must reconfigure MySQL, see: http://dev.mysql.com/doc/mysql/en/fulltext-fine-tuning.html

However, this talks about MySQL generically, and not with regard to using it with MediaWiki.

So ... if you took all the defaults for your installation of the OS, MySQL and MetaWiki and have only a small database (i.e. just installed), here's how to go about getting three letter searches:

  • Firstly, if you already have a big wiki, the change can take a long time. The MySQL reference above has someone who did this for a 4Gb database and it took 10 days! So be careful. Now let's have a go.
  • The parameter to reset is inside MySQL, and as noted above is discussed on the MySQL web site. Go there for more details if you're into MySQL.
  • Find the config file for My SQL - this is normally my.cnf, located in /etc
  • Edit my.cnf and add the relevent parameter in this file (ft_min_word_len=3). This is normally set to 4 for performance reasons - 4 is the default and not in the my.cnf file when installed. Make sure this is put under the [mysqld] section of my.cnf
  • Restart MySql, using the Service Controller or stop and restart mysqld from the command line
  • Go into MySql (mysql at the command line)
  • Issue the MySql command that you need to look at the wiki database (use wikidb;) - note that this may be different if you changed the default wiki database install schema with something like my_wikidb
  • Rebuild the search indexes by asking to repair the searchindex table. The command line to type is: repair table searchindex quick; an example is as follows showing what you should see:
mysql> repair table searchindex quick;
+--------------------+--------+----------+----------+
| Table              | Op     | Msg_type | Msg_text |
+--------------------+--------+----------+----------+
| wikidb.searchindex | repair | status   | OK       |
+--------------------+--------+----------+----------+
1 row in set (0.08 sec)</code>
mysql>
  • Retest from your wiki server that you can see TLAs now - make sure you do have one in your wiki to find though otherwise you won't find it!
  • The above was performed on a Fedora Core 4 OS, server was a Compaq ML570. It should work ok for other distributions.

Important note

If you have upgraded mysql from v 3.xx in order to do the above, you must change the following parameter in your LocalSettings.php file in order for this to work.

From $wgDBmysql4 = false; To $wgDBmysql4 = true;

[edit] How can I recover the searchindex table?

First try REPAIR TABLE. See How to Repair Tables in the MySQL manual for more information.

If your searchindex table is broken beyond repair, you can run maintenance/rebuildtextindex.php from the command line to recreate it. Sorry, there's no web-based version of this at the current time. Instructions on executing from the commandline here and for allowing command line execution of php files here.

This fault occurred after a (old version) MediaWiki was hacked (text added fortunately not destroyed).

[edit] Can I insert data/template data from another wiki in realtime into my wiki page as my wiki page displays?

If I want to put info in my wiki from Wikipedia (eg a template such as below) without copying all the data, eg. templates, variables, images etc. etc. to my wiki can I just 'link' to the other wiki (eg. Wikipedia) in real time as my page loads?

This feature is in development. Check back when 1.6 comes out. -- Tim Starling 07:27, 1 February 2006 (UTC)

Version 1.6 is out now, but I wonder where this feature has left or where is discribed how to use it? I'm very highly interested in it! Please help me! drundanibel 2006-05-22

[edit] Configuration

[edit] I access the wiki pages on my system by writing http://localhost/directorypath. But, if I try writing http://systemname/directorypath, it throws an error that page not found.

"Localhost" means the machine you are on; it is not a real name, it's like a pronoun. You need to check two things: does your server have a name? and does the world know this name?

To find the first, in Linux, go to a system prompt and type the command "hostname". This will return the server's full name. If it doesn't have a name, you can set it (if you are logged in as root) with the command "hostname -v servername". And second, is the server known by this name on the network? Check with your system/network administrator to find out if the server is registered in the DNS (Domain Naming Sytem) for this domain. You can test this by using PING from a command line - if you can ping the server by IP address but not by name, then it is not in the DNS.

If both of those are correct, then ...

Maybe there is something wrong with your Apache virtual hosts? See the Apache documentation for details.

If you use EasyPHP, your Apache config file will have a line: "#Listen 127.0.0.1:80". Just add another line below: #Listen <name or IP>:80" and it works.

[edit] How do I change the look and feel of MediaWiki for my own site?

See MediaWiki look and feel for a detailed explanation.

[edit] I have lost my skin after upgrading!

Clear your browser cache and reload the page.

[edit] How can I disable/enable tabs at top (monobook), add history navigation to article pages, or otherwise move around functional components from page to page?

Under 1.5, to disable all view top tabs, create a new skin according to the instructions in MediaWiki look and feel#Skin and name this MonoBookNoViews. Set this as the default theme. Logged in users will need to change their default theme to see the tabs to edit pages, however.

You will need to remove the section of code in the MonoBookNoViews.php file which generates the views (top tabs).

Search for this code:

      <div id="column-one">
 <div id="p-cactions" class="portlet">
   <h5><?php $this->msg('views') ?></h5>
   <ul>
     <?php foreach($this->data['content_actions'] as $key => $action) {
        ?><li id="ca-<?php echo htmlspecialchars($key) ?>"
        <?php if($action['class'])
                 { ?>class="<?php echo htmlspecialchars($action['class']) ?>"<?php } ?>
        ><a href="<?php echo htmlspecialchars($action['href']) ?>"><?php
        echo htmlspecialchars($action['text']) ?></a></li><?php
      } ?>
   </ul>
 </div>
 <div class="portlet" id="p-personal">

Replace it with this:

      <div id="column-one">
 <div class="portlet" id="p-personal">

To remove the "Edit" links in the content sections, modify monobooknoviews/main.css.

Replace this line: (Please note that this will only work for IE browsers - all others will still display the Edit link next to a section)

* html div.editsection { font-size: smaller; }

With this line:

* html div.editsection { display: none !important; }

[edit] How do I change the default skin for users that are not logged in?

Set $wgDefaultSkin = 'monobook'; in LocalSettings.php (see example). Make sure that the quoted skin is in lowercase in the LocalSettings.php file (ie: 'monobook', not 'MonoBook') regardless of how the skin name is actually capitalized.

[edit] I've changed settings in LocalSettings.php, such as $wgSitename, but they don't show up in my browser. Why not?

(Note: As always, first ensure that you're not viewing a cached page - perform a "hard refresh", clear the browser cache, or view a page that didn't exist before the change.)

There was a bug in versions of MediaWiki prior to 1.3.6 where variables, such as $wgSitename, were interpolated into user interface messages at install, rather than when the message was requested (Bugzilla:296). The result was that any later changes to these variables would have no effect on these messages, since the software simply saw them as plain text; all UI messages can be reset to their defaults (with the new variable values) by running the maintenance/rebuildMessages.php script. If you upgrade to the latest version of MediaWiki first, these will include dynamic references to the variables (e.g. {{SITENAME}}) and should therefore reflect future configuration changes.

Some language files incorrectly set $wgSitename to a local transliteration of "Wikipedia". If this happens, you need to edit the language file, at languages/Language??.php. Search for the $wgSitename and remove the lines where it is set. If you find a problem like this in the most recent version of MediaWiki, you should report it at bugzilla.

[edit] Does MediaWiki automatically capitalize the first letter of $wgSitename?

Yes. This can be changed using the $wgCapitalLinks configuration setting.

[edit] How do I change which page is the "Main Page"?

Visit the "MediaWiki:Mainpage" page, enter the name of the new default page, and save changes. MediaWiki should recognize the setting and use the new default page.

[edit] How can I change what the <title> of each page is? Where do I make changes?

Most of the text that you want to change, can be found in the namespace of MediaWiki.

In order to change titles, texts, announcements and the like, go to Special:Allmessages, where you will see the text associated with the pages you wish to change. (As far as I can tell, you need to log in as an administrator (like the one you made when you installed) to edit the protected entries in the MediaWiki namespace.)

If you want to change the title in your browser, you need to edit MediaWiki:pagetitle. Go there and edit it just like you would any other page in your Wiki.

In recent versions of MediaWiki, MediaWiki:pagetitle is $1 - {{SITENAME}} by default. If {{SITENAME}} is producing the wrong text for you, you need to set $wgSitename in your LocalSettings.php.

If $wgSitename is correct in LocalSettings.php but {{SITENAME}} is still wrong, it may be that you're using a user-contributed language file which incorrectly sets $wgSitename to a transliteration of "Wikipedia". Edit the language file to correct this. For example, the hebrew language file is at languages/LanguageHe.php in your wiki directory.

Don't forget to clear your browser cache after you fix it.

[edit] How do I enable uploads?

If you get the following message:

Sorry, uploading is disabled.

See http://www.mediawiki.org/wiki/Configuring_file_uploads. For more information and trouble shooting, see Uploading files.

[edit] When I try to upload files in Mediawiki 1.5 I always get a "The file is corrupt or has an incorrect extension. Please check the file and upload again." error.

With 1.5, first check whether the mediawiki temp dir exists and has the right permissions. In general, check your php- and mediawiki-logs for any obvious errors.

After, try in the maintenance directory to rebuildImages and then, display the pages with a trailing ?action=purge.

This may happen if MediaWiki fails to determine the correct MIME-Type for the file you are uploading. For images, this should always work if your PHP has the GD extension enabled. For other files, the file_info or mimemagic extensions can be used (make sure they are configured correctly if present). Alternatively, use an external program for mime detection, by settings wgMimeDetectorCommand to the desired command.

Under linux, you can use the following in LocalSettings.php:

$wgMimeDetectorCommand= "file -bi"; #use external mime detector (linux)

to your LocalSettings.php file solves this problem in some cases.

If all else fails, you should be able to solve this by adding

$wgVerifyMimeType = false;

to your LocalSettings.php file. Note that this will turn off most sanity checks on the file - this is a security hazard.

The file command did not work for me under Fedora Core 4. It turns out that SELinux was preventing the php script from running file on uploaded files. I had to disable SELinux for httpd [1] to get uploading and mime typing to work correctly. 16:02, 25 February 2006 (UTC)

[edit] When I try to upload bigger files in Mediawiki 1.5 I always get "Internal error! couldn't move "/tmp/somefile" to "/wikidir/images/temp/filename"

On top of the screen you should see a PHP-error aswell saying something like this:

Warning: move_uploaded_file():
 Unable to access /temp/somefile in /wikidir/includes/SpecialUpload.php on line 370

The most common reason for this is that upload_max_filesize in php.ini is set to the default of 8MB, and you want to upload a file that is larger. See this section of the PHP manual for more PHP-related problems. Be careful that you're editing the right php.ini -- PHP is well known for its decoy configuration files. Create a .php file with nothing but <?php phpinfo() ?> to inspect your configuration settings.

Another way to fix this could be to go to the /images folder and there to manually create two folders: /temp and /thumb Apparently they were not included in my distribution

One user has reported that setting $wgUploadSizeWarning to a large number in LocalSettings.php fixed this problem for them.

  • Try this:

(1) Create a blank php.ini file and place it in your wiki root directory.
(2) Add to that file this line: upload_max_filesize = 25M (or whatever max size you want)

It worked for me -- User:WikiDontLoseThatNumber


(traslate this, please. I speak Spanish): En una Wiki corriendo sobre Windows corregí este error dando permisos de lectura/escritura al directorio donde está instalado el php (c:\php) y al directorio en donde está la wiki. O sea que es un problema de permisos de las carpetas compartidas.

In a Wiki running on windows I fixed this by adding writing/reading permissions to the directory where php is installed (c:\php) and the directory where the wiki is. That probably means the problem is related to shared directories permissions.

[edit] How do I use templates?

See Help:Templates.

[edit] How do I set the timezone for my MediaWiki?

There are two timezone-related settings: $wgLocaltimezone and $wgLocalTZoffset. Set both in LocalSettings.php. $wgLocaltimezone is used for formatting the timezone in signatures, and should be set to the locale name, for example "Europe/Berlin". $wgLocalTZoffset sets the default user preference the number of hours your local time differs from server time, and is used for timestamps seen in recent changes and history views. $wgLocalTZoffset should be set in minutes, for example, "-480" equals 8 hours behind the server time.

[edit] How does DST (Daylight Savings Time) work with MediaWiki?

This is dependent on the server, as the MediaWiki gets the date from the server's timestamp.

[edit] How do I make my base URLs shorter?

See eliminating index.php from the url for details. You may need access to server files like httpd.conf.


[edit] How do I enable PHP to be processed in a page rather than displayed?

[edit] How do I activate HTML-Tags, e.g. "<input>" or "<form>" ?

It seems to be possible to activate HTML-Tags like "<input>" or "<form>" (Have a look at [2], and note the PayPal Buttons working). How does it work ?

  1. if you need those HTML-tags for one action only (e.g. this PayPal-Button), but don't want HTML to be activated generally, write your own MediaWiki_Extension which outputs your HTML-needs (e.g. PayPal extension).
  2. the more "dirty"-way is to add $wgRawHtml = true; to your LocalSettings.php. If you do so, HTML-tags are activated on every page.

Note: even after adding $wgRawHtml = true;, it appears you must surround your html tags with <html> and </html>. XHTML compliance requires ALL tags to be enclosed.

[edit] How do I make $wgRawHtml = true; work only with sysop user and not with other users?

[edit] How do I make it so only admins can add full html codes to articles?

You can't. Due to the way a wiki works, it's all or nothing. But with a bit of work, one can tweak things so that the HTML code will only be executed if the page is protected, thus effectively giving whoever has the protection privilege the necessary control.

[edit] How do I make external links pop up in new browser windows?

Opening external links in a new window

[edit] Why are embedded images not displayed, not even in their image description pages?

  • This problem is often caused by a missing MIME type in image fields. Try running the maintenance/rebuildImages.php maintenance script from the command line. Rob Church Talk 17:10, 8 February 2006 (UTC)
  • If that still doesn't work, check whether the magic file used for MIME detection (e.g. /etc/httpd/conf/magic) knows about PNG. If not, adding the following line in the image section will fix it:
0       string          \x89PNG         image/png
  • I'm not sure if this will help any of you, but if you're using a subdomain with hotlink protection, add your subdomain to the list of allowed linkers. After days of installing and reinstalling MediaWiki, then trying another one, I finally realized that it was the subdomain issue.

[edit] How do I enable the "Printable version" option when using MonoBook skin?

[edit] How do I disable external links from showing in the printable version of a page?

Can somebody help me to deactivade this? When I try to print all the tables become too wide.

I was able to prevent external links from displaying by commenting out the section "// Expand links for printing" in file skins\common\IEFixes.js.

[edit] How do I change default user preferences?

The following applies to MediaWiki 1.4 and later.

The MediaWiki default user preferences are in the language file, i.e. languages/Language.php if you're using English. Don't edit that file, just use it for reference, like you do with DefaultSettings.php.

Say if you want to change the default number of search results on a page. Language.php says:

/* private */ $wgDefaultUserOptionsEn = array(
       ...
       'searchlimit'  => 20,
       ...
)

To change it to 50, put this in your LocalSettings.php:

$wgDefaultUserOptions = array( 'searchlimit' => 50 );

Note that you are setting $wgDefaultUserOptions, which cont