Manual:Running MediaWiki on FreeBSD

Most of the prerequisites for running MediaWiki can be installed on FreeBSD from the ports system (not packages). See http://www.freebsd.org/ports/

MediaWiki itself may also be installed directly from the ports tree (/usr/ports/www/mediawiki). You may wish to install some of its dependencies beforehand if you want to run some of the newer versions.

Install Apache, php and MySQL together
This is for FreeBSD 4.11 only. Installing php4 will include mysql-client and apache at the same time. I recommend installing these packages through pkg_add rather than stand/sysinstall, because sysinstall has some problem in getting the correct version of packages. After the installation, please check the version of mysql-client and install the same version of mysql-server. The versions of the packages in my system are listed below:


 * apache-1.3.29_3.tgz
 * mysql-server-4.0.18_1.tgz
 * mysql-client-4.0.18_1.tgz
 * php4-4.3.6.tgz

The command I use for installation pkg_add -r php4-4.3.6.tgz pkg_add -r mysql-server-4.0.18_1.tgz 123

Database
Install MySQL from ports, databases/mysql40-server.

Web server
''' Apache can be installed from ports, www/apache13 or www/apache2.

PHP
''' PHP might be installed from ports (lang/php4) and its extensions from lang/php4-extensions. This will make an Apache DSO module, and PHP extensions would be dynamically loaded.

When using www/apache2, don't forget the line AddType application/x-httpd-php .php .phtml in httpd.conf.

Extensions
You would need these extensions from php4-extensions:
 * php4-mysql - for database, obviously
 * php4-iconv - Character set translations
 * php4-imagick - Image manipulation library
 * php4-ldap - in case of LDAP authentication (future feature)
 * php4-mbstring - for fast multibyte string manipulations
 * php4-pcre - Regular expressions (MW has lots of these)
 * php4-readline - for some features of CLI scripts
 * php4-session - Session support
 * php4-xml - XML Parser
 * php4-zlib - Compressed object storage

This list might be incomplete.

If you are installing the above as separate packages, you need to install graphics/ImageMagick instead of php4-imagick.

Install www/turck-mmcache from ports if you wish to use Turck opcode cache.

TeX support
Install these from ports for math rendering support if you haven't already got them:


 * lang/ocaml
 * print/latex
 * print/dvips
 * graphics/ImageMagick
 * print/ghostscript-gnu-nox11

For FreeBSD 4.11 users: please install the following packages instead because dvips is not available in the package list: teTeX already includes latex and dvips. However, it will conflict with latex2e. So please make sure that your system does not have latex2e.
 * ocaml
 * teTeX
 * ImageMagick
 * gmake

texvc's Makefile requires GNU make. Once ocaml is installed, go into the math/ subdirectory of the MediaWiki package and run 'gmake'. The texvc executable will be installed by install.php if you use it and have $wgUseTeX set to true, or you can copy it in manually. Put it in 'math' subdirectory under where wiki.phtml is.

Note that certain versions of FreeBSD (5.3) may require a cvsup of the ports directory to work correctly. If you attempt this installation and run into errors, try cvsup'ing your ports tree and remaking the above ports -- ImageMagick specifically.

The MediaWiki-1.1.0 and earlier releases use an option for dvips which the ports version doesn't support. The latest CVS version has used a more compatible option; if using an older release, edit render.ml and change "-o -" to "-f" at the end of the first line, then build texvc.

Note that latex, dvips, and convert must be in the PATH for texvc to shell out to them. If apache is started on system startup it may not have /usr/local/bin in the PATH, and this PATH will be inherited by texvc and image output won't happen. Restart apache after boot, or put this into LocalSettings.php:

putenv("PATH=".getenv("PATH").":/usr/local/bin");

In some installations, dvips seems to have problems with texvc's command line parameters: it doesn't recognize 'ps:-' as an input filename specifier for stdin. Change this line to use plain '-' in file render.ml and compile texvc again:

let cmd_convert finalpath = "/usr/local/bin/convert -quality 100 -density 120 - " ^ finalpath ^ " >/dev/null 2>/dev/null"

Matrix Support
The default install of math libraries will not have the asmfonts installed. Asmfonts are used for matrix, bmatrix, and pmatrix math libraries.

Instructions and fonts can be obtained from the following links:


 * http://www.ams.org/tex/distrib.html#unix
 * http://www.ams.org/tex/amsfonts.html

Likely, the fonts will need to be installed in /usr/local/share/texmf

Memcached
Install it from databases/memcached. Please note, that it should not be reachable from outside, as that would cause severe security risks for your installation. If you're running on a jail, your localhost address would be mapped to a Net-visible address.

Some problems and workarounds

 * I have different configurations for standalone php and module-php. install.php database functions don't work in standalone php.


 * Workaround - run install.php from commandline to copy files. Then copy it to install2.php and comment out parts which copy files. Also hard-code db root password and delete lines where commandline input is expected. Run install2.php by accessing it from the webserver.


 * I've installed MediaWiki with Cs locales and wiki.phtml doesn't work.


 * LanguageCs needs LanguageUtf8.php to work. Copy LanguageUtf8.php to the same directory as LanguageCs.php

wiki.phtml still does not work


 * Hard-code including LanguageCs.php after Language.php in Setup.php

"PHP's XML module is missing; the wiki requires functions in this module and won't work in this configuration. If you're running Mandrake, install the php-xml package."
 * During installation i get this error message:


 * Make sure php extensions port is installed.

$cd /usr/ports/lang/php(4|5)-extensions $make install distclean


 * select xml from the menu

$ldconfig (to link newly installed xml library)


 * Restart apache.

Next page: meta:Help:Configuration >