modified on 20 August 2009 at 12:17 ••• 5,511 views

How to install SemanticMediaWiki


Jump to: navigation, search

This is quick guide on how to setup a (Semantic) MediaWiki.


Installation steps

This guide assumes that you have a running web server (e.g. Apache) with PHP support and a mySQL database running. You will also need the mySQL db root account or a user account with privileges to create tables in a database. If you do not have all this, XAMMP provides you all this out of the box without much installation overhead!

Core MediaWiki

  • Download the latest MediaWiki release [1]
  • Extract the files to your web browser directory
  • Make the config subdirectory writable (chmod a+w config)
  • Hop into your browser, surf into the wiki directory and fill out the configuration form
  • After saving, move the file config/LocalSettings.php into the parent directory
  • Call the wiki URL in your browser to test if it worked

SemanticMediaWiki extension (optional)

  • Download the latest release of SemanticMediaWiki [2]
  • Probably check if it is compatible with your MediaWiki version (normally the recent versions should be ok)
  • Extract the directory SemanticMediaWiki to [wikipath]/extensions/
  • Insert at the end of the file [wikipath]/LocalSettings.php: include_once('extensions/SemanticMediaWiki/includes/SMW_Settings.php'); and enableSemantics(''); (you may replace with something more meaningful)
  • In your wiki, log in as a user with admin status and go to the page Special:SMWAdmin to do the final setup steps
    • If the wiki db-user does not have rights, set db root account credentials in AdminSettings.php and call SWM_Setup.php with PHP from the command line

Semantic Forms (optional)

  • tbd.

Common configuration options

These are common MediaWiki configuration options which can be set in [wikipath]/LocalSettings.php.

You will never need all of these settings. Just copy/paste what is suitable for your case. Most options are sort of self-explanatory.


# Error reporting (only useful for debugging)
error_reporting( E_ALL );
ini_set( 'display_errors', 1 );
$wgShowExceptionDetails = true; 
$wgShowSQLErrors = true;

# Memory limit
ini_set( 'memory_limit', '20M' );

# Uploads
$wgEnableUploads = true;
$wgFileExtensions = array( 'png', 'jpg', 'gif', 'doc','xls','ppt','pdf' ); 

$wgAllowExternalImages = true;

$wgUseTrackbacks = true;

# Enable subpages in the main namespace
$wgNamespacesWithSubpages[NS_MAIN] = true;

$wgLanguageCode = 'de';

User interface

# Logo & Favicon
$wgLogo = "$wgScriptPath/images/mylogo.gif";
$wgFavicon = "$wgScriptPath/images/favicon.ico"; 

$wgDefaultSkin = 'monobook';

## For attaching licensing metadata to pages, and displaying an
## appropriate copyright notice / icon. GNU Free Documentation
## License and Creative Commons licenses are supported so far.
$wgEnableCreativeCommonsRdf = true;
$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright
$wgRightsUrl = "";
$wgRightsText = "GNU Free Documentation License 1.2";
$wgRightsIcon = "${wgStylePath}/common/images/gnu-fdl.png";
# $wgRightsCode = "gfdl"; # Not yet used

User rights

$wgWhitelistRead = array( "Special:Userlogin", "-", "MediaWiki:Monobook.css" );
$wgGroupPermissions['*'    ]['createaccount']   = false; 
$wgGroupPermissions['*'    ]['edit']            = false; 
$wgGroupPermissions['*'    ]['read']            = false;
$wgGroupPermissions['user' ]['createaccount']   = true;   
$wgGroupPermissions['user' ]['edit']            = true;  
$wgGroupPermissions['user' ]['read']            = true;

This will close your wiki for anonymous users. Only users can create accounts (for other users).

Extension settings

# ParserFunctions (
# Search Log (

# InputBox (

# DynamicArticleList (
require_once( "extensions/DynamicArticleList/DynamicArticleList.php" );



#SemanticMediaWiki (
$smwgQComparators = '<|>|!|~'; // + pattern search comparator ~ for strings
$smwgLinksInValues = true;
$smwgShowFactbox = SMW_FACTBOX_NONEMPTY; 

#SemanticForms (
$sfg24HourTime = true;

#Semantic Result Formats (
#srfInit( array('graph', 'timeline', 'calendar', 'eventline') );

LDAP/Actice Directory

require_once( "$IP/extensions/LDAPAuth/LdapAuthentication.php" );
$wgAuth = new LdapAuthenticationPlugin();

# Uncomment this line to see debug messages:
#$wgLDAPDebug = 10;
#$wgShowExceptionDetails = true;

//The names of one or more domains you wish to use
//These names will be used for the other options, it is freely choosable and not dependent
//on your system. These names will show in the Login-Screen, so it is important that the user 
//understands the meaning.
$wgLDAPDomainNames = array("");

//The fully qualified name of one or more servers per domain you wish to use. If you are
//going to use SSL or StartTLS, it is important that the server names provided here exactly
//match the name provided by the SSL certificate returned by the server; otherwise, you may
//have problems.
$wgLDAPServerNames = array(  ""=>"");
//Allow the use of the local database as well as the LDAP database.
//Good for transitional purposes.
//Default: false
$wgLDAPUseLocal = true;
//The type of encryption you would like to use when connecting to the LDAP server.
//Available options are "tls", "ssl", and "clear"
//Default: tls
$wgLDAPEncryptionType = array(""=>"clear"); // ssl
$wgLDAPUseSSL = true; 
#$wgLDAPBaseDNs = array('' => 'OU=Users,OU=IPE,dc=fzi,dc=de');
$wgLDAPBaseDNs = array('' => 'dc=fzi,dc=de');

$wgLDAPSearchAttributes = array(  '' => 'sAMAccountName');

#$wgLDAPSearchAttributes = array('DOMAINNAME' => 'sAMAccountName');
#$wgLDAPProxyAgent = array("DOMAINNAME"=>"PROXYUSERDN");
#$wgLDAPProxyAgentPassword = array("DOMAINNAME"=>"PROXYUSERPASS");
$wgLDAPUpdateLDAP = array(""=>false);
$wgLDAPAddLDAPUsers = array(""=>false);

//The search string to be used for straight binds to the directory; USER-NAME will be
//replaced by the username of the user logging in.
//This option is not required (and shouldn't be provided) if you are using a proxyagent
//and proxyagent password.
//If you are using AD style binding (TDOMAIN\\USER-NAME or USER-NAME@TDOMAIN) and
//want to be able to use group syncing, preference pulling, etc., you'll need to set
//$wgLDAPBaseDNs and $wgLDAPSearchAttributes for the domain.
#$wgLDAPSearchStrings = array("xxx"=>"xxx\\USER-NAME" );
$wgLDAPSearchStrings = array( ""=>"");

# restrict to logged in users only
$wgWhitelistRead = array("Special:Userlogout", "Special:Userlogin", "-", "MediaWiki:Monobook.css" );
$wgGroupPermissions['*'    ]['createaccount']   = false; 
$wgGroupPermissions['user']['createaccount'] = false;
$wgGroupPermissions['sysop']['createaccount'] = false;
$wgGroupPermissions['*'    ]['edit']            = false; 
$wgGroupPermissions['*'    ]['read']            = false;
$wgGroupPermissions['user' ]['edit']            = true;  
$wgGroupPermissions['user' ]['read']            = true;

//Option for pulling specific preferences. Available options
//are "email", "realname", "nickname", "language"
//Default: none; disabled
//Available in 1.2a
$wgLDAPPreferences = array(  ""=>array( "email"=>"mail","realname"=>"cn")  );