HowTo: Install MediaWiki on a GoDaddy Value Plan

InfoDabble > Tech Notes > MediaWiki > HowTo: Install MediaWiki on a GoDaddy Value Plan
Jump to: navigation, search

By Eric Hartwell - latest update July 30, 2007[1]

Contents

This MediaWiki installation is currently running on a GoDaddy shared hosting package. I like to think of GoDaddy as the McBurgers of hosting and domains - they're huge, they're everywhere, they're cheap, and they're utterly consistent. Just don't ask for anything that's not on the menu.

Set up a Linux Economy Plan. You'll need to wait until the domain is active and you can access your site via www.my-domain-name.com.

Fresh Installation

  1. Install MediaWiki
    1. Download the MediaWiki installation files from MediaWiki.org.
    2. Upload the installation files to a suitable directory or subdirectory on the server.
      • If you plan to use short URLs (see below), use a different name than the final one. For example, if your site with short URLs will be /InfoDabble, you might install to /wiki.
    3. MediaWiki versions later than 1.6 need PHP 5.
      • By default on GoDaddy, files with a .php extension run under PHP 4 and files with the .php5 extension run under PHP 5.
      • Change the .htaccess file so .php files to run under PHP 5.
    4. Create a MySQL database for your wiki.
    5. Run the MediaWiki configuration program in /install-directory/config
      • MediaWiki installation detects ImageMagick and configures itself to use the version in /usr/bin/. Unfortunately, this is ImageMagick 5.5.6, which may be incompatible with MediaWiki 1.9+
      • GoDaddy lets you use ImageMagick version 6 instead. Edit LocalSettings.php and set $wgImageMagickConvertCommand to /usr/local/bin/convert instead of /usr//bin/convert.
         
  2. Verify that MediaWiki works as expected.
    • In my case, the only problem was with the ImageMagick version as described in 1.5 above..
       

Copying an Existing Wiki

Transferring the wiki is fairly painless, if you start with a clean MediaWiki installation. I use MediaWiki 1.10 (see version information).

If you want to upgrade your MediaWiki version, it's a good idea to do the upgrade on the old site first so you can troubleshoot version upgrade problems separately from site change problems.

  1. Transfer the MediaWiki database
    1. Export the original wiki's database using phpMyAdmin.
    2. Upload the databse dump file to the new server.
      • phpMyAdmin will import files up to 2M in size (This applies to the zipped size if you compress your dump).
      • If you're transferring a wiki of any size, you'll probably run into phpMyAdmin's 2M file-size limitation. Use BigDump, which automates the staggered import of large and very large MySQL Dumps.
      • On my import, I ran into the Bigdump error, "current query includes more than 300 dump lines". Go back to the original installation, and in phpMyAdmin Clear the "Extended inserts" check box before doing the export.
      • Depending on the format of the source dump, you may need to delete all tables in the database before starting the load.
         
  2. Transfer the MediWiki customization and images
    1. MediaWiki still stores its image files outside the database. Copy the contents of the wiki/images directory and all its subdirectories. It's OK to overwrite whatever's already there on the new server.
    2. Copy your custom site code, if any
      • wiki/extensions if you're using any extensions
      • wiki/skins if you've customized any of the skins
      • Copy any other custom files, other than LocalSettings.php
         
  3. Customize LocalSettings.php
    • The configuration program already set the appropriate server and database settings in LocalSettings.php. You don't want to overwrite these with settings from your old wiki.
    • Edit LocalSettings.php and copy over any site customization from your old server's LocalSetttings.php. Keep a backup, and be careful not to overwrite any site-specific settings.
       
  4. Verify that everything works as expected.
    • If you use absolute URLs in the wiki, such as for images in style sheets, make sure the targets are correct.

Short URLs

Short URLs[2] that hide PHP mechanics from the browser bar for normal pages are good user interface. These short URLS are not implemented in MediaWiki by default because they are done in concert with Web server configurations that can get complicated and may vary depending on the specific Web server being used.

  • On a shared host, there's no access to the server configuration file. Instead, you need to use Apache's .htaccess file to use an alias or a rewrite, but preferably not both.
  • GoDaddy Value Plans is intended for low cost, not great flexibility. They provide .htaccess files primarily for password protection; any additional .htaccess functionality is unsupported and "as-is". Nevertheless it's possible to configure MediaWiki short URLs.

Wiki in a subdirectory

1. This wiki is installed in the virtual host directory /infodabble

The default full URL for this page is http://www.ehartwell.com/infodabble/index.php?title=HowTo:_Install_MediaWiki_on_a_GoDaddy_Value_Plan

2. Edit or create /.htaccess with the following content:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^wiki/(.*) infodabble/index.php?title=$1 [PT,L,QSA]
RewriteRule ^wiki/*$ wiki/ [L,QSA]
Now this page can also be accessed from the URL http://www.ehartwell.com/wiki/HowTo:_Install_MediaWiki_on_a_GoDaddy_Value_Plan
Note that the remapped directory /wiki must be different from the actual directory /infodabble.

3. Add or edit the following setting in LocalSettings.php. This causes the HTML generated by MediaWiki to refer to "/wiki/Articlename" instead of the default.

$wgArticlePath = "/wiki/$1";
Now MediaWiki refers to /wiki/Articlename instead of the default /wikiroot/index.php?title=Articlename. It generates links to this page as /wiki/HowTo:_Install_MediaWiki_on_a_GoDaddy_Value_Plan

4. If you want to redirect the site root to the home page of your wiki, add the following line to /.htaccess below the lines aboce:

RewriteRule ^/*$ wiki/ [L,QSA]
Now you can access the wiki's main page from the URL http://www.ehartwell.com or http://www.ehartwell.com/.

Wiki at the site root

You can also configure the wiki so that it appears at the root of your site instead of in a subdirectory.

Note: MediaWiki warns that you should never do this as it creates an unstable URL structure, requiring a never-ending series of special-cases, methods, and hacks leading to various page names being unusable on your wiki. If you must take this approach, first configure your wiki in an aliased subdirectory as in steps 2 and 3 above and verify that everything works cleanly before proceeding.

Instead of remapping directories, you can install the wiki in the root directory instead of a subdirectory.

However, to use "pretty" URLs by setting $wgArticlePath = "/$1"; in LocalSettings.php, you will still need to tweak /.htaccess with exceptions so that valid subdirectories like http://www.ehartwell.com/ftp don't get remapped to http://www.ehartwell.com/index.php?title=ftp.

Finally, note that all of the Wikimedia projects use the subdirectory syntax, http://en.wikipedia.org/wiki/Wikimedia. Do you really need to be different?


  1. Revision history:
    July 30, 2007 - added section on URL rewriting
    May 4, 2007 - original version
  2. Manual:Short URL from the MediaWiki manual