Some Notes on Wordpress under FreeBSD

WordPress 2.1 was relatively straightfoward to install on my FreeBSD 6.0-RELEASE #0 system, given that PHP 5.2.1 and MySQL 5.1.15-beta were already set up. Below are notes on a few issues that came up while setting up WordPress for one of my users:

Install Location

The standard installation instructions assume that the WordPress files will be located at the root of your web site's directory sctructure (e.g. public_html), or in the subdirectory that corresponds to the path in the URL. But the WordPress documentation does also descrbe the procedure for locating the files elsewhere.

mysqli vs. mysql

WordPress makes use of the older MySQL PHP extension (php_mysql) rather than the MySQL "improved" extension (php_mysqli).

For those who don't wish to install the mysql extension just to use WordPress, a shim that modifies WordPress to use mysqli is available. While it doesn't take advantage of the improvements in mysqli in a way that impacts performance, it does allow you to avoid installing, maintaining, and wasting memory on the older mysql extension.

The other alternative is to load both the mysql and mysqli extensions in your PHP configuration. The PHP documentation notes: "If you would like to install the mysql extension along with the mysqli extension you have to use the same client library to avoid any conflicts." Using FreeBSD's ports system, the process went smoothly for me: I simply built and installed databases/php5-mysql and added in /usr/local/etc/php/extensions.ini.


If you're installing WordPress for your own use, any Apache-specific configuration can be taken care of in the most efficient place: /usr/local/etc/apache22/httpd.conf or the appropriate file in /usr/local/etc/apache22/vhosts.d. However, if non-administrators will be using WordPress, and they want to use permalinks, you may find it easier to allow the use of .htaccess files. (Your Apache configuration will also need mod_rewrite enabled.)

In addition to adding AllowOverride FileInfo for the appropriate directory, you want to create an empty .htaccess file in the appropriate directory and chmod 666 it (or the equivalent to allow your web server user to write to it). (It's probably a Good Idea to change those permissions back to something more restrictive once everything is working the way your users want it to.)


Finally, if your system is locked down as tightly as mine, you may need to edit /etc/hosts.allow to allow connections to MySQL via TCP/IP. For my setup, where MySQL lives on the web server, this was as simple as adding the following lines:

mysqld : localhost [::1] : allow
mysqld: ALL : deny

(Naturally, these lines need to appear before the ALL : ALL section near the bottom of the file.)

Copyright 2007 Szarka Networks.
This work is licensed under a Creative Commons License.