mwForum Installation

Before reading any further, please make sure you're actually reading the right version of the documentation, i.e. the one that came with your download.

Contents

Requirements

Operating system

mwForum should be able to run on any platform with Perl and a webserver.

Language: Perl 5.8.1

Perl is usually already installed as part of Unix-like systems. Windows versions are available from ActiveState.

Database server: MySQL 4.1 or PostgreSQL 8.0 or SQLite 3.2.3

MySQL is the most widely used option. If you want to use PostgreSQL or SQLite, see FAQ.html first, the database installation instructions below are only for MySQL.

Database interface Perl modules: DBI, DBD::mysql or DBD::Pg or DBD::SQLite

DBI and, depending on the chosen database server, DBD::mysql or DBD::Pg or DBD::SQLite can be installed as packages for most Unix-like systems. For ActivePerl on Windows, the modules can be downloaded with ActivePerl's package manager PPM. Most webhosters should have them installed already. Otherwise, they can be downloaded from CPAN.

Webserver

Every CGI-capable webserver should do the job, though the optimal platform consists of Apache with mod_perl 2.x.

Installation

Since the spectrum of possible installation environments is very broad, no installation guide could possibly give exact and foolproof instructions for all existing environments. This problem is aggravated by the fact that both webhosters and Linux packagers almost always make the installation of Perl applications more complicated than that of e.g. PHP applications by the way they set up the webserver.

The example commands below assume an installation performed by a root user using Linux, Apache and MySQL. If your platform differs from that, and it most likely will, you'll have to improvise (or ask your local administrator or guru for help). This is especially true if you don't have shell (aka console or command line) access, but have to configure things using some kind of Web interface and/or FTP client. There are also more specific instructions for some platforms available in the support forum.

CGI Installation

  1. Unpack the contents of mwforum-x.x.x.tar.gz into your home directory.
    
    shell> cd ~
    shell> tar -xzf mwforum-x.x.x.tar.gz
    
    
  2. Create a subdirectory for mwForum in your server's CGI directory. This will be called the script directory.
    
    shell> mkdir /usr/local/apache/cgi-bin/mwf/
    
    
  3. Copy the contents of the extracted script directory into your created script directory.
    
    shell> cp mwforum-x.x.x/script/* /usr/local/apache/cgi-bin/mwf/
    
    
  4. Make all Perl scripts executable by the user the webserver is running as.
    
    shell> chmod 755 /usr/local/apache/cgi-bin/mwf/*.pl
    
    
  5. Create a subdirectory in your server's documents directory. This will be called the data directory, and contains images and stylesheets.
    
    shell> mkdir /usr/local/apache/htdocs/mwf/
    
    
  6. Recursively copy the contents of the extracted data directory into the created data directory.
    
    shell> cp -r mwforum-x.x.x/data/* /usr/local/apache/htdocs/mwf/
    
    
  7. If the Perl interpreter (or a link to it) isn't located at /usr/bin/perl, you'll have to change the first line of each .pl script or use other methods of linking the scripts to the Perl interpreter.
  8. Inside the created script directory, rename MwfConfigGlobalDefault.pm to MwfConfigGlobal.pm and ignore it for now.
  9. Rename MwfConfigDefault.pm to MwfConfig.pm and edit it. The file contains comments with info about its options. This file only contains the basic configuration options necessary to start the forum, the rest of the options will be loaded from the database and can be configured in the Web interface. If you have a shared hosting account, you should get the values for the MySQL database server, name, username and password from your provider.
  10. Make sure MwfConfig.pm can't be downloaded through the webserver. Downloading will often be impossible by default if you use a dedicated cgi-bin directory, but on other setups, especially where script and data files are mixed in the same directory, you might have to deny downloading explicitly. The script.htaccess file contains an example on how to do this. Test if MwfConfig.pm is safe by trying to download it yourself.

Database Installation

The first two steps assume that you have installed your own MySQL server and have root access. If you're using your provider's database server, skip those two steps. You'll usually need the MySQL root password for these. The MySQL root password is empty by default, but you should change it to something else ASAP. Values that you have to adapt to your specific situation are written in italic.

  1. To create the database, execute something like the following command:
    
    shell> mysql -e "CREATE DATABASE mwforum CHARSET=utf8"
    
    
  2. To grant the necessary access rights, execute something like:
    
    shell> mysql -e "GRANT ALL ON mwforum.* TO mwforum@localhost IDENTIFIED BY 'password'"
    
    
  3. To create the tables, execute "perl install.pl" from your forum's script directory. Afterwards, delete install.pl and upgrade.pl. If there are error messages, double-check your settings in MwfConfig.pm, and if that doesn't help, ask in the support forum.

Cronjob Installation

The following features of mwForum require regular execution of the mwForum cronjobs (scheduled tasks, files cron_jobs.pl, cron_subscriptions.pl, cron_bounce.pl and cron_rss.pl). If you don't use any of them, you can skip this section, although the use of the main cronjob (cron_jobs.pl) is highly recommended for the database table defragmentation and optimization alone.

Once again, the actual setup depends on your platform, but the typical installation on a Unix system looks something like the following when executing the main cronjob nightly at 03:10 (don't run it more often than once a day) and the subscriptions cronjob at 03:20. The last line shows an example of how to backup your forum database with mysqldump. See FAQ.html for more info on the feeds cronjob.


# Crontab
10 3 * * *   user   cd /usr/local/apache/cgi-bin/mwf && perl cron_jobs.pl
20 3 * * *   user   cd /usr/local/apache/cgi-bin/mwf && perl cron_subscriptions.pl
00 4 * * *   user   mysqldump mwforum | gzip > ~/mwforum.sql.gz

If your forum is hosted by a provider that doesn't provide cronjobs or similar means of task scheduling, and you want to use any of the above features, you have to either manually start the cronjob(s) on a regular basis, or use the cron emulation feature that starts the main cronjob on the first page request of every day. Cron emulation is enabled with the cronEmu forum option. Either workaround also requires the $cfg->{scriptFsPath} and $cfg->{perlBinary} options in MwfConfig.pm to be set up.

Configuration

  1. Enter the forum through forum.pl and register a user account. As the first user you'll get forum administrator status automatically. Since at this point you haven't had a chance to configure the forum's email options yet, you won't get your password through email like normal users. It's hardcoded to "admin" instead.
  2. Log in with your chosen username and the hardcoded password. Near the top of the forum page there's the link to your user options and profile pages, where you can configure your preferences and fill in profile information. On the options page, there's also the link to the password page from where you can change your password to a different one.
  3. In the page bar (second bar from the top) you'll see an additional row of administration link buttons (normal users won't). Enter the forum options page and edit whatever forum options you want to change now. Since there are a lot of options, it's ok to only change the email options and some of the display options, and look at the rest later. Note that the internal names of the options are listed at the end of the respective option's headline. These names are sometimes referred to in the documentation and in the support forum.
  4. Enter the category admin page and create one or more categories.
  5. Enter the board admin page, create one or more boards and configure their options. Please note that newly created boards are not visible and writable to normal users by default, so make sure to change those options if the board is supposed to be public.
  6. If you want to change the visual styling of the forum, read the CSS Styling section of FAQ.html.

mod_perl Notes

If you intend to run mwForum under plain CGI, or have never heard of mod_perl anyway, you can skip this section. Apache/mod_perl is only necessary for running high traffic sites (as it makes the Perl script execution much faster). mwForum supports mod_perl 1.x (for Apache 1.x) and mod_perl 2.x (for Apache 2.x). Apache 1.x is very old at this point, though, and is not getting tested anymore.

For more information on mod_perl, read its documentation. Installation of mod_perl itself is beyond the scope of this text, the following steps are only those specific to mwForum:

  1. Install libapreq (also known as Apache::Request), which is used for efficient CGI parameter and upload handling. For mod_perl 2.x, libapreq2 2.05 (aka Apache2::Request) is required.
  2. Add "use lib '/usr/local/apache/mwf';" to your startup.pl (set the path to your script directory), so that the scripts can find their modules. If you don't use a startup.pl, you can also add "PerlSwitches -I/usr/local/apache/mwf" to the Apache configuration instead.
  3. If you want to use a separate Apache configuration section for mwForum, it could look something like the following for mod_perl 2.x:
    
    PerlRequire /usr/local/apache/conf/startup.pl
    Alias /forum/ /usr/local/apache/forum/
    <Location /forum/>
      Options +ExecCGI
      SetHandler perl-script
      PerlResponseHandler ModPerl::Registry
      PerlOptions -SetupEnv -ParseHeaders
    </Location>
    
    

If you want to host multiple forums, see FAQ.html for details.

Any changes to configuration files (and the default forum options in MwfDefaults.pm during upgrades) won't take effect until an Apache reload/restart, even with Apache::Reload or similar enabled for those files.

Windows Notes

mwForum has been tested and works with Apache 2.2 on Windows XP and Windows 7, including mod_perl 2.

Depending on your webserver and configuration, you'll usually have to adjust the "#!/usr/bin/perl" line in all .pl scripts to something like "#!perl" (if the perl executable is in the PATH), or "#!c:\perl\bin\perl.exe" (if not), unless you use other means of linking .pl files to the Perl interpreter (like mod_perl). Under Apache 2.x, you might also be able to use the ScriptInterpreterSource directive.

For configuration options in MwfConfig.pm that are specifying filesystem paths, use forward slashes (c:/forum/) instead of the usual DOS backslashes.

Common CGI Errors

These CGI problems sometimes occur after installation:

500 Internal Server Error

This is a generic HTTP error message displayed by the browser that by itself isn't very helpful. The actual Perl error message can usually be found in the webserver's error log. If you don't have access to the error log, you can try adding "use CGI::Carp qw(fatalsToBrowser);" somewhere near the top of the script that gives you the 500 error. This will then hopefully print a more useful error message to the browser. Remove the CGI::Carp line after resolving the problem.

One of the possible reasons triggering this message is a syntax error in a configuration or language file that you have edited. You can test the syntax of these files by calling "perl -c file.pm".

If you ask about error 500 on the support forum without having found a more specific error message, there isn't much we can do to help you.

Premature end of script headers

This log error message, which usually appears as error 500 in the browser, means that a script has failed before it could print the HTTP headers. Alone, this message is not very helpful either, but it's typically preceded or followed by a more specific error message that points to the real problem.

When there are no additional error messages, this error may also be caused by script files that have been garbled or truncated during upload, or that have the wrong (DOS/Unix) linefeed format. If possible, compare the local and the remote versions of the script to see whether they're the same, or whether the remote script is garbled or truncated. The linefeed format can be converted during upload from DOS to Unix with most FTP programs, or on some servers with "recode l1/cl..l1 *.pm *.pl".

Where to Go From Here

Check the online help page and FAQ.html for more information on features and administration, and ask in the support forum if any questions remain. There is no extensive guide to each and every feature, but who has time to read or write that anyway.