Problems upgrading WordPress

I decided that it really was time I upgraded my installation of WordPress from version 2.2.1. This is normally a really simple process, but not this time.

Rather than overwriting the existing installation, I always start afresh. I backed up the databases as usual, disabled all plugins, downloaded the latest version (2.9.2) and then proceeded to incoroprate my edits into the new version. I also copied across the theme and plugins.

However, when I tried to run the upgrade script, I got the following error logged in Apache’s error_log

[notice] child pid 19836 exit signal Segmentation fault (11)

After speaking to my Hosting company, they advised that they had had a lot of compatibility problems with PHP 5.3.0 and advised downgrading to PHP 5.2.12 instead.

All is OK now

Desktop Publishing

I have been asked to layout a newsletter for the local civic society as the usual person was too busy. Although I have an uninstalled copy of Microsoft Publisher somewhere, I had never used it before and wanted to find an open source alternative. Enter Scribus and GhostScript. In order to get this to work on Windows 2000, I also needed to download the GDI+ SDK.

Getting started was fairly simple, but in order to run the tutorials at I needed to download various ICC profiles and fonts

Simply extract the contents of the two ICC files into the /libs/profiles subdirectory of Scribus and extract the .ttf files from the Luxi fonts into your Fonts folder (Start>Settings>Control Panel>Fonts)

Building GLib

Glib is available from GTK by FTP. At the time of writing, the current version is 2.12.12

Download the source code

  • Connect to your server using PuTTY or some other SSH client
  • Connect to GTK’s FTP server by typing the command ftp
  • Login using the username anonymous and password anon@
  • Change to the directory where the source code is stored cd /pub/glib/2.12/
  • Change the mode to binary by entering the command binary
  • Download the file using the command get glib-2.12.12.tar.gz
  • Also download the md5 checksum to verify the veracity of your download get glib-2.12.12.tar.gz.md5
  • Close your FTP session by typing quit
  • Having downloaded the source code, extract the files into a new directory by entering the command gunzip -c glib-2.12.12.tar.gz|tar x

Install dependencies

We need to download and install the libiconv and gettext libraries before we can build GLib. Also, since we do not have root access at Westhost, we need to tell all Linux packages to install to a different directory other than /usr/local. We do this by specifying

./configure --prefix=/usr/mylocal
NOTE: Create the directory /usr/mylocal if it does not already exist

Library Command Download Location
libiconv wget
libiconv wget
gettext ftp
gettext ftp

libiconv and gettext depend on each other, so we need to build libiconv then gettext and the rebuild libiconv.

Build libiconv

gunzip -c libiconv-1.11.tar.gz | tar x
cd libiconv-1.11
./configure --prefix=/usr/mylocal >log.config 2>err.config
Check err.config for errors
make >log.make 2>err.make
This will build with errors, so do not check err.make for errors
make install >log.install 2>err.install
cd ..

Build gettext

cd pub/gnu/gettext
mode image
get gettext-0.16.tar.gz
get gettext-0.16.tar.gz.sig
gunzip -c gettext-0.16.tar.gz |tar x
cd gettext-0.16
./configure --prefix=/usr/mylocal >log.config 2>err.config
Check err.config for errors
make>log.make 2>err.make
Check err.make for errors
make install> log.install 2>err.install
Check err.install for errors

Rebuild libiconv

cd ../libiconv-1.11
make distclean
./configure --prefix=/usr/mylocal >log.config 2>err.config
Check err.config for errors
make>log.make 2>err.make
Check err.make for errors
make install> log.install 2>err.install
Check err.install for errors
libtool --dry-run --finish /usr/mylocal/lib
libtool --finish /usr/mylocal/lib
cd ..

Build the GLib library

  • Change into the new directory cd glib-2.12.12
  • Run autoconfigure to determine the build parameters ./configure –with-libiconv –prefix=/usr/mylocal >log.config 2>err.config
  • Check the err.config file for any errors
  • Build the library make >log.make 2>err.make
  • Check err.make for errors
  • Install the library make install >log.install 2>err.install

Errors we encountered

#error GNU libiconv not in use but included iconv.h is from libiconv

Added –with-libiconv to ./configure

warning: passing arg 2 of `g_async_queue_push’ discards qualifiers from pointer target type

This is only a warning and so can be ignored

mod-gzip – How To Download pages faster and Save Server Bandwidth

I recently ran these pages through a Web Optimiser and the speeds were not that impressive, so I have decided to implement mod_gzip. This will compress the textual portion of these pages so that they download quicker.

The procedure will NOT follow the familiar procedure for those who follow this site, so read on…

  • Download the source from using the command wget, for example wget Choose the mirror nearest to your server. If you are running Apache 2.0, then you will need to donload the module from here instead.
  • Unzip this file and extract the contents so that we can get on with the build gunzip -c mod_gzip- | tar x
  • Change into the source directory cd mod_gzip-
  • The directions for building mod_gzip are included at the end of the ChangeLog file.

    There are two ways to build mod_gzip:

    1. statically compiled into Apache and
    2. a DSO-File for mod_so.

    The DSO-Version is much easier to build. Just type

    make APXS=/path/to/apxs
    make install APXS=/path/to/apxs
    /path/to/apachectl restart

    The apxs script is normaly located inside the bin directory of Apache.

    The path to APXS is /usr/local/apache/bin/apxs or /usr/sbin/apxs, so we will use the command
    make APXS=/usr/sbin/apxs >log.make 2>err.make
    NOTE:You will get an error complaining about ok_to_send being unused. This Warning can be safely ignored.
    mod_gzip.c: In function `mod_gzip_sendfile2':
    mod_gzip.c:5262: warning: unused variable `ok_to_send'

  • The final step of the build process is to install the module. This will copy the library to the relevant place and edit your httpd.conf file.
    make install APXS=/usr/sbin/apxs >log.install 2>err.install
    The installer inserted two lines into the httpd.conf file, which are commented out. However, it did not quite get it right on my system, so it is just as well that they are commented out! The lines read

    LoadModule frontpage_module modules/
    #LoadModule gzip_module /usr/lib/apache/

    and should have read

    LoadModule frontpage_module modules/
    <IfDefine HAVE_GZIP>
    LoadModule gzip_module /usr/lib/apache/

    The variable HAVE_GZIP is automatically created by the start up process. The installer also made the same mistake with the AddModule directives which read
    AddModule mod_frontpage_sphera.c
    #AddModule mod_gzip.c

    instead of

    AddModule mod_frontpage_sphera.c
    <IfDefine HAVE_GZIP>
    AddModule mod_gzip.c

  • There are still a couple of changes to make to the httpd.conf file according to Apache’s own website. The following needs to be added to the configuration file; I added it just after the AddModule (within the define block)
    mod_gzip_on Yes
    mod_gzip_can_negotiate Yes
    mod_gzip_dechunk Yes
    mod_gzip_minimum_file_size 600
    mod_gzip_maximum_file_size 0
    mod_gzip_maximum_inmem_size 100000
    mod_gzip_keep_workfiles No
    mod_gzip_temp_dir /usr/local/apache/gzip
    mod_gzip_item_include file \.html$
    mod_gzip_item_include file \.txt$
    mod_gzip_item_include file \.jsp$
    mod_gzip_item_include file \.php$
    mod_gzip_item_include file \.pl$
    mod_gzip_item_include mime ^text/.*
    mod_gzip_item_include mime ^application/x-httpd-php
    mod_gzip_item_include mime ^httpd/unix-directory$
    mod_gzip_item_include handler ^perl-script$
    mod_gzip_item_include handler ^server-status$
    mod_gzip_item_include handler ^server-info$
    mod_gzip_item_exclude file \.css$
    mod_gzip_item_exclude file \.js$
    mod_gzip_item_exclude mime ^image/.*

    Additional filetypes can be defined. For example, there is no need to compress PDF files as they are already compressed, so we could also add
    mod_gzip_item_exclude mime ^application/pdf$
  • You will also need to create the mod_gzip_temp_dir specified in httpd.conf. mkdir /usr/local/apache/gzip
  • Next restart Apache and check that everything is still working. If you get the error
    Syntax error on line xxx of /etc/httpd/conf/httpd.conf:
    Cannot add module via name 'mod_gzip.c': not in list of loaded modules
    then you forgot top remove the # from the LoadModule command or is not in the correct directory.

Installing and Running Rsync


This post is very long, so I have broken it down into multiple pages.
Page 1 – Installing rsync daemon on your server
Page 2 – Installing rsync client on your PC
Page 3 – Scheduling rsync automatically
Page 4 – Errors I encountered and their solutions

Download and build rsync from source

  • Start a SSH session to your server
  • Download the source from samba wget
  • Extract the source code gunzip -c rsync-2.6.9.tar.gz | tar x
  • Change into the directory so that we can build the software cd rsync-2.6.9
  • You will need the GCC compiler installed if you have not already done so.
  • Run the auto configure script so that the server can work out if everything necessary is present ./configure –prefix=/usr/mylocal –with-included-popt >log.config 2>err.config
  • Check that no errors were logged by the configure script less err.config
  • Build the application make >log.make 2>err.make
  • Check that no errors were logged during the build process less err.make
  • Install the application make install >log.install 2>err.install
  • Check that no errors were logged during the installation less err.install

Configure the rsync daemon

We cannot use the default port (873) on Westhost as this is used by Westhost’s own application for nightly backups. Nor can we use ports below 1024 as these require us to run as root. However, ports 8730-8732 are unassigned by IANA (Internet Assigned Numbers Authority), so we can use any of these.

  • Create a directory for your configuration files. mkdir /etc/rsyncd
  • Create a new configuration file pico /etc/rsyncd.conf. The configuration file consists of a general configuration section which applies to every module and one (or more) modules. Each module starts with its name in square brackets, for example [rsyncd_module].
    This sample configuration file will allow upto 3 rsync clients to read the contents of /ftp/pub/rsync PROVIDED that they authenticate themselves by providing the correct credentials AND their IP Address is in the range specified by hosts allow. The connection will close down after 5 minutes (300 seconds) of inactivity.

    #Global definitions
    #Message of the Day
    motd file = /etc/rsyncd/rsyncd.motd
    log file = /var/log/rsyncd.log
    pid file = /var/run/
    lock file = /var/run/rsyncd.lock
    port = 8730

    #Module Options begin here
    path = /ftp/pub/rsyncd
    comment = My Very Own Rsync Server. This area is ReadOnly
    max connections = 3
    timeout = 300
    uid = myuserid
    gid = vuser
    read only = yes
    list = yes
    auth users = rsync_user
    secrets file = /etc/rsyncd/secrets
    hosts allow =
    hosts deny = *

    Replace the module name, myuserid, vuser and rsync_user as necessary for your system.
    If you want to limit those who have access to your rsync server, then specify the “auth users” and “secrets file”. If you want to restrict where they can access the rsync server from, then you will also need the “hosts allow” and “hosts deny” variables. The value for “hosts allow” should be set to your IP address if you use a static IP (example or the range if you use a dynamic IP (example Multiple possibilities can be separated by a space. If you don’t understand this bit, then leave “hosts allow” and “hosts deny” out of your configuration for now.

  • Create the secrets file pico /etc/rsyncd/secrets. Format is username:password in plain text, one user per line. If you want to communicate over SSH, then ensure that one of the users is your account’s user id; it need not have the same password here as for logging in.
  • The secrets file must not be readable by other users, so change the access rights by using the command chmod 600 /etc/rsyncd/secrets
  • Create your Message Of the Day file pico /etc/rsyncd/rsyncd.motd. This text will be displayed when a connection is made to your server.