Help:Installation 1.9.0 - 1.9.2

From semantic-mediawiki.org
SMW admin manual
Installation
Configuration
Concept caching
Fixed properties
Using SPARQL and RDF stores
SPARQLStore
Pretty URIs
Troubleshooting
Repairing data and data structures
Extensions
Basic extensions
Semantic extensions
SMW user manual
Table of Contents

This page describes how to install Semantic MediaWiki 1.9.0.x, 1.9.1.x and 1.9.2.x on a Linux-based server if you have shell access. There is also a help page on how to install on a Windows-based server. This is the strongly recommended installation method. If you do not have shell access. i.e. you cannot use Help:Using Composer for installation and upgrading, you will have to install the file release as described on this help page on installing the file release of SMW. Please always check the exact requirements and follow the instructions carefully. Make sure you understand the legal disclaimer in the file COPYING before proceeding.

To upgrade a wiki running an older version of SMW, be sure to read the relevant section before starting the upgrade.

NoteNote:If you are using MediaWiki 1.23 and higher and/or PHP 5.4 and higher you are strongly encouraged to install or to update to Semantic MediaWiki 2.0.0 or higher. Semantic MediaWiki 1.9 is not recommended for productive use with these versions.

Requirements[edit]

This section lists the minimum requirements. See also the page on compatibility.

MediaWiki
  • MediaWiki 1.19+ though MediaWiki 1.22+ is recommended. If MediaWiki 1.19.x to 1.21.x is used then the Extension Installer extension 0.2.2+ is additionally required.
PHP
  • PHP 5.3.2+
Database
  • MySQL 5.0.2+ though MySQL 5.1+ is recommended (except 5.1.49 to 5.1.52) or
  • SQLite 3.7+ or
  • PostgreSQL 8.3+ though 8.4+ is recommended (beta-support only)

General notes[edit]

  • Semantic MediaWiki has dependencies that will made available during the installation.
  • Individual extensions to Semantic MediaWiki, e.g. Extension "Semantic Result Formats" may have different requirements.
  • Individual extensions to Semantic MediaWiki may not be compatible with this release (yet). Please see those extensions' documentation pages, or contact the respective developers, for further information.
  • SMW uses the PHP mb_*() multibyte functions such as mb_strpos in the php_mbstring.dll extension. This is standard but not enabled by default on some distributions of PHP. See the PHP manual for details.
  • For installation and upgrade, SMW needs the rights to create new tables (CREATE) and to alter tables (ALTER TABLE). You can remove both rights after SMW is set up. The script "SMW_setup.php" can use the DB credentials from "LocalSettings.php" for this purpose, avoiding the need of extra rights for the wiki DB user.
  • When using the SQL backend (the default data store for SMW), SMW creates and alters temporary tables for certain semantic queries. To do this, the wiki's database user account must have privileges for CREATE TEMPORARY TABLES and DROP. If you don't wish to allow such privileges, you can disable these specific query features by adding the following to "LocalSettings.php":
$smwgQSubcategoryDepth = 0;
$smwgQPropertyDepth    = 0;
$smwgQFeatures         = SMW_ANY_QUERY & ~SMW_DISJUNCTION_QUERY;
$smwgQConceptFeatures  = SMW_ANY_QUERY & ~SMW_DISJUNCTION_QUERY & ~SMW_CONCEPT_QUERY;


  • When using a SPARQL backend, SMW uses the CURL functions of PHP. These functions may have to be enabled/installed to be available.

Installation[edit]

MediaWiki 1.22+
  1. Install Composer - please follow the instructions at installing Composer to do this.
  2. Run the installation script[1] from the base directory[2] of your MediaWiki installation:[3]
    php composer.phar require mediawiki/semantic-media-wiki "~1.9"
    
  3. Run the setup script from the base directory[2] of your MediaWiki installation:
    php maintenance/update.php
    
  4. Add a call to enableSemantics() to the end of the "LocalSettings.php" file. enableSemantics() takes in the domain name of the wiki; a wiki located at "example.org", for instance, should have the following call:
    enableSemantics( 'example.org' );
    
    The calls require_once … must neither be added for Semantic MediaWiki nor for Validator since Composer loads the extensions automatically.
  5. Add optional settings[4] apart from one exception[5] to the "LocalSettings.php" file as desired below the enableSemantics() call.
  6. In case you want to use additional semantic extensions which are not installed via Composer like e.g. Extension "Page Forms" you still have to invoke them by adding the respective line require_once … to you "LocalSettings.php" file below the enableSemantics() call.
  7. See the page "Special:Version" on your wiki to verify that the extension is successfully installed.
  8. Test your installation as described on the help page about testing SMW.
  9. Done!
MediaWiki 1.22-alpha
This version contains a malfunctioning "composer.json" file and should not be used with SMW 1.9+. If you are using MW 1.22-alpha, you should first upgrade MediaWiki before doing the rest.
MediaWiki 1.19.x to 1.21.x
  1. Install the "Extension Installer" extension - see installing "Extension Installer" for how to do this.
  2. Add the following line to the "require" section of the "composer.json" file in the …/extensions/ExtensionInstaller/ directory.[6]
    "mediawiki/semantic-media-wiki": "~1.9"
    
  3. Run the installation script from the …/extensions/ExtensionInstaller/ directory:[3]
    php composer.phar install
    
  4. Run the setup script from the base directory[2] of your MediaWiki installation:
    php maintenance/update.php
    
  5. Add a call to enableSemantics() to the end of the "LocalSettings.php" file. enableSemantics() takes in the domain name of the wiki; a wiki located at "example.org", for instance, should have the following call:
    enableSemantics( 'example.org' );
    
    The calls require_once … must neither be added for Semantic MediaWiki nor for Validator since Composer loads the extensions automatically.
  6. Add optional settings[4] apart from one exception[5] to the "LocalSettings.php" file as desired below the enableSemantics() call.
  7. In case you want to use additional semantic extensions which are not installed via Composer like e.g. Extension "Page Forms" you still have to invoke them by adding the respective line require_once … to you "LocalSettings.php" file below the enableSemantics() call.
  8. See the page "Special:Version" on your wiki to verify that the extension is successfully installed.
  9. Test your installation as described on the help page about testing SMW.
  10. Done!

Upgrading[edit]

Use these instructions to update an existing ≤ SMW 1.8.x installation from e.g. 1.8.0.5 to 1.9.0 etc.

Upgrading from SMW 1.8.x
  1. Backup your database and installation.
  2. Delete the directories SemanticMediaWiki/ and Validator/ from the …/extensions/ directory.
  3. Remove the formerly required invocations of "Semantic MediaWiki" and "Validator" from the "LocalSettings.php" file, i.e. the following two lines:
    require_once "$IP/extensions/Validator/Validator.php";
    
    require_once "$IP/extensions/SemanticMediaWiki/SemanticMediaWiki.php";
    
  4. Re-install Semantic MediaWiki as described in the section on installing SMW.[7]
  5. Run the refresh database script from the base directory[2] of your MediaWiki installation:[8]
    php extensions/SemanticMediaWiki/maintenance/SMW_refreshData.php -d 50 -v
    
  6. Done!
Upgrading from ≤ SMW 1.7.x

Please upgrade to SMW 1.8.0.5 first, as described on the help page on upgrading to SMW 1.8.x.

Updating SMW 1.9.x[edit]

Use these instructions to update an existing SMW 1.9 installation from e.g. 1.9.0 to 1.9.1 etc.

MediaWiki 1.22+
  1. Backup your database and installation.
  2. Run the update script from the base directory[2] of your MediaWiki installation:[3]
    php composer.phar update
    
  3. See the page "Special:Version" on your wiki to verify that the extension was successfully updated.
  4. Run the setup script from the base directory[2] of your MediaWiki installation:
    php maintenance/update.php
    
  5. Run the refresh database script from the base directory[2] of your MediaWiki installation:[8]
    php extensions/SemanticMediaWiki/maintenance/SMW_refreshData.php -d 50 -v
    
  6. Done!
MediaWiki 1.19.x to 1.21.x
  1. Backup your database and installation.
  2. Run the update script from the …/extensions/ExtensionInstaller/ directory:[3]
    php composer.phar update
    
  3. See the page "Special:Version" on your wiki to verify that the extension was successfully updated.
  4. Run the setup script from the base directory[2] of your MediaWiki installation:
    php maintenance/update.php
    
  5. Run the refresh database script from the base directory[2]:[8]
    php extensions/SemanticMediaWiki/maintenance/SMW_refreshData.php -d 50 -v
    
  6. Done!

Troubleshooting[edit]

After the upgrade of an existing SMW installation the following messages can occur which solely depend on the configuration of the "LocalSettings.php" file:

Warning: Class '…' not found in …
This kind of message appears if the Extension "Validator" extension is still explicitly invoked. To resolve this the following line has to be removed:
require_once "$IP/extensions/Validator/Validator.php";
Notice: Use of undefined constant …
This kind of message appears because SMW namespace constants (SMW_NS_PROPERTY, SMW_NS_TYPE and SMW_NS_CONCEPT) are delayed due to the parameter $smwgNamespaceIndex being a prerequisite and its initialization has to happen first it can be processed. To resolve this you have to add
enableSemantics( 'example.org' );
prior to any parameter (e.g. $wgContentNamespaces, $wgNamespacesToBeSearchedDefault and $wgNamespaceProtection) making reference to these namespace constants. In case you choose to manually set $smwgNamespaceIndex to something other than the default value of 102, you must do this above the enableSemantics() call.
Fatal: Call to undefined function enableSemantics() …
This kind of message appears for MW ≤ 1.21.x if the Extension Installer extension is included after the call to enableSemantics() (see above). Make sure that the call to include Extension Installer comes first.


After updating an existing SMW 1.9.0 installation the following messages may occur:

Database error: A database query error has occurred. This may indicate a bug in the software.
This error appears after an upgrade from SWM 1.9.0 to 1.9.1 when moving a page and if you have not updated the semantic store. To resolve this run the setup script from the base directory[2] of your MediaWiki installation:
php maintenance/update.php

Notes[edit]

  1. Note that, if you have Git installed, it's recommended to install composer with the "--prefer-source" flag, so that Composer uses Git to download the code. In other words, instead of calling "composer install" or "php composer.phar install", as that page states, you should call "composer install --prefer-source" or "php composer.phar install --prefer-source".
  2. 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 This is the directory which contains the "LocalSettings.php" file.
  3. 3.0 3.1 3.2 3.3 In case you installed Composer "globally" on your server, you will have to drop the php and .phar particles from the command.
  4. 4.0 4.1 See the help page on configuring SMW. Usually only a few configuration parameters have to be changed if there is a need to do so at all.
  5. 5.0 5.1 If you manually set $smwgNamespaceIndex to something other than the default value of 100, you must do this above the enableSemantics() line instead. Make sure that the value set is ≥ 100 as well as an even number.
  6. See also the example "composer.json" file, which already contains the line to be added here.
  7. Please refer to the applicable section, i.e. "with shell access / without shell access".
  8. 8.0 8.1 8.2 This is an optional step to take to assure that the semantic store is valid and up to date.

Video tutorial[edit]


The revision id is not annotated properly in the master page!
The template {{Docinfo}} may not be embedded in: Installation
This documentation page applies to all SMW versions from 1.9.0 to 1.9.2.
Other versions: 1.8.0 – 1.8.01.7.1 – 1.7.11.7.0 – 1.7.0[…]       Other languages: fr

Installation en 1.9.0 1.9.2