WordPress package configuration in Ubuntu Server?

So I wanted to play with some Linux-only PHP performance tools and installed Ubuntu Server 10.10 in VirtualBox (for the record I have little clue about Linux, never used it extensively).

Turned out Ubuntu (Debian) has WordPress package that does some things differently then I am used to.

Read More

I was especially puzzled with this instead of usual wp-config.php:

$debian_server = preg_replace('/:.*/', "", $_SERVER['HTTP_HOST']);
$debian_server = preg_replace("/[^a-zA-Z0-9.-]/", "", $debian_server);
$debian_file = '/etc/wordpress/config-'.strtolower($debian_server).'.php';

if (!file_exists($debian_file)) {
    header("HTTP/1.0 404 Not Found");
echo "<b>$debian_file</b> could not be found. The file is either not readable by this process or does not exist. <br>
    Please check if <b>$debian_file</b> exists and contains the right password/username.";
    exit(1);
}

require_once($debian_file);

define('ABSPATH', '/usr/share/wordpress/');
define('WP_CORE_UPDATE', false);
define('WP_ALLOW_MULTISITE', true);

require_once(ABSPATH.'wp-settings.php');

Why does it do stuff this way? Does it play well with multisite and WordPress in general? Do I understand right that I won’t be able to update WordPress core of such install, other than by updating package?

Related posts

Leave a Reply

3 comments

  1. The code you posted is to have multiple wp-config.php-style wordpress configuration files with one codebase. the configuration is then based on the domain name.

    imagine the localserver is listening on http://localhost.localdomain/ (no idea which one is the default with ubuntu), then the configuration file would be: /etc/wordpress/config-localhost.localdomain.php.

    This is made so that the wordpress package can be upgraded w/o overwriting your own configuration. So the reason why this is done is to have an easy upgrade path with the ubuntu package manager.

    I assume this does not play well with multisite, but I have no clue. It should work flawlessly with normal wordpress usage.

    As Thomas MacDonald already suggested, you can always go with a manual install. I would recommend that as well because you wrote that you run performance and analyse tools and I think you want to do this on the original package. So I assume that there is no need for you to rely on the pre-made ubuntu wordpress package. That’s mainly for those who want to install it the “ubuntu way”.

    Good start for you with linux, it really rocks for development. I’m sure you will enjoy it once you figured all the new things out.

  2. By the looks of it loads the config file from the /etc/wordpress directory instead of from /usr/share/wordpress, where the package is installed by default, probably for security reasons.

    I would recommend not using the package and instead installing WordPress as you would with any other installation – the setup it uses here could affect you later on – the package might not be updated, which would then make updating WP core more difficult.

  3. I use Ubuntu for everything except testing layouts in Internet Explorer. Definitely go with a manual install rather than installing through the package manager. In my experience packages available through the package manager tend to be a bit behind the present release. Not a big deal if your installing Guaydeque to listen to your mp3’s for example but not advisable for something that needs to be up-to-date 100%.