MediaWiki

From DreamHost
(Redirected from MediaWiki/Enabling uploads)
Jump to: navigation, search

Overview

Mediawiki.fw.png

MediaWiki is a program you can download and use to create a wiki site such as Wikipedia. The application is great for creating knowledge base pages just like an encyclopedia.

For more information about MediaWiki, visit MediaWiki's official site:

MediaWiki is offered as a One-Click Install in your DreamHost web panel.

Installing MediaWiki

The simplist way to install is to use the One-Click Install feature in your panel which installs the software for you.

The other option is to install it manually which requires you to download the files yourself and upload them to your web server.

Detailed instructions to manually install MediaWiki are provided in the following article:

Extensions

MediaWiki offers many different types of extensions which you can use to add further functionality and customization to your site. Visit the following page for further details:

Google Analytics

You can also add Google Analytics on your MediaWiki if you wish. Visit the following page for detailed instructions:

Utilities

Running maintenance scripts

In the MediaWiki root install, there is a subdirectory named /maintenance which includes various scripts you can run on your MediaWiki application. In order to run the php scripts, you must enable shell access on your domain.

In order to run the scripts, you must enter ‘php’ before the filename. For example, run the following command if you wish to run the script eval.php in the maintenance directory:

php eval.php
Note2 icon.png Note: If you simply type ‘php’, it defaults to PHP 5.4 effective June 2015. You can specify another version by using the following instead:
  • /usr/local/php53/bin/php
  • /usr/local/php54/bin/php
  • /usr/local/php55/bin/php
  • /usr/local/php56/bin/php


To learn more about the individual scripts, visit the following page:

Thumbnail problems

MediaWiki can occasionally have problems generating image thumbnails, such as returning corrupted images or the error message "Error creating thumbnail". A common cause of this is not enough memory.

If you upload a large image and see "Error creating thumbnail" where a thumbnail should be, try adding the following to your LocalSettings.php file in your site’s main directory:

$wgMaxShellMemory = 524288;

SVG images

For best results in generating thumbnails of SVG images, you may wish to install librsvg.

Note2 icon.png Note: The SVG installation process is not supported and is recommended only for advanced users. More information can be found on the following page:


Email

Domain spoofing

Add the following to your LocalSettings.php file:

$wgUserEmailUseReplyTo = true;

This spoofs the domain so that the sending user's email is in a Reply-To header instead of the From header. Otherwise, the email that users try to send each other through Special:EmailUser on your wiki will not be delivered.

Notifications

Given the SMTP quota, you need to be careful if you enable $wgEnotifWatchlist.

If a page is watchlisted by 100 users who have that user preference enabled, then a change to that page uses up your quota for an hour, if you are on shared hosting.

Blocking MediaWiki spam

Combating SPAM
Provides steps you can take to combat SPAM on your website.
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.
CAPTCHA
Enabling a Captcha on any form will help to reduce spam.
Restrict account creation
By default, anyone can create an account on your wiki. However you can restrict who has the ability to create accounts.
User rights
You also have control over user rights. You can disable disable non-user edits with this feature.

Caching

There are several ways to cache your data using MediaWiki. View the following article for detailed information:

Unicode normalization

To use the intl PECL extension for Unicode normalization, follow this guide on creating a phprc file. Once added, you can add the following line to it:

extension = intl.so

Enabling uploads

View the following guide for instructions on how to enable file uploads:

Backing up

View the following guide for instructions on how to backup your data:

Also view the Dreamhost guide for further instructions:

Security

Passwords and HTTPS

The One-Click Dreamhost MediaWiki installation uses a form on an HTTP web page to take your password. This means that your password will go over the network in clear text. To use HTTPS, you must enable Secure Hosting. Once an SSL certificate is added to your domain, you can force HTTPS in any request by adding code to an .htaccess file. View the following article for further details:

Forcing HTTPS

LocalSettings.php permissions

LocalSettings.php has your database login information in it, including the database username and password. After you move the LocalSettings.php file to your root directory, have a look at its permissions.

You should update the permissions on that file to 640 or 600. This can be done by running the following command:

$ chmod 640 LocalSettings.php

This makes the file only writeable for the owner while the group can still read it. However the most secure option is to mark the file as only readable/writable by the owner:

$ chmod 600 LocalSettings.php

This way, other people on the same server will not be able to steal your MySQL password from the file. View the following article for further details on permissions:

Unix File Permissions

Move database credentials to another file

Another good security idea is to set up a separate PHP file stored in your user's directory. This file will store your credentials and will pass them as variables. In this setup, your LocalSettings.php file would link to this new file. For example:

  1. In your user's directory (not the domain's directory) create a new directory called "external_includes"
  2. In this new folder, create a file called "database_info.php".
  3. The full path to this new file would be:
    /home/[yourusername]/external_includes/database_info.php
  4. The file would include the following (fill in your true values in the quotes):
     <?php
     $database_server = "mysql.domain.com"; 
     $database_name   = "databasename"; 
     $database_user   = "username";
     $database_pw     = "password";
     ?>
    
  5. Next, remove the current database credentials in your LocalSettings.php file.
  6. Replace those lines with the following:
     # enhanced DB security
     require_once ("/home/[yourusername]/external_includes/database_info.php");
     
     $wgDBserver     = $database_server;
     $wgDBname       = $database_name;
     $wgDBuser       = $database_user;
     $wgDBpassword   = $database_pw;
     
     # DB variables not security related - leave these alone from how when you set up your wiki
     $wgDBprefix     = "wiki_";
     $wgDBtype       = "mysql";
    

This way, even if someone is able to read your LocalSettings file, it still won't reveal any credentials.

Upgrading

Always make sure to first backup your database and website files before making any adjustments. This way, if something were to error you could quickly replace your files. View the following article for details:

If you used the One-Click Install feature to install MediaWiki, visit the following article for upgrade instructions:

If you have a manual install, view the following guide:

Licensing settings

You have the option of which licensing to use. View the following article for details:

Note2 icon.png Note: Wikipedia uses GFDL. If you want content to be able to be reused in Wikipedia and other GFDL-projects, then you must use GFDL (or multi-license to use both). In general, if there are other projects you want to work with, you should have compatible licensing.


Troubleshooting

Enable debugging

You can enable debugging by adding lines at the bottom of your LocalSettings.php file. By enabling this, you are provided detailed debugging information to help isolate the cause.

View the following article for further details:

Once you finish troubleshooting your install, you should disable your debugging settings.

Short URLs

You can shorten the URLs to appear more user friendly. For example, you can change:

Original URL example: wikisite.tld/w/index.php?title=Main_Page

to

Shortened URL example: wikisite.tld/wiki/Main_Page

View the following article for further instructions:

See also