Many years ago now, we started using My Address Book (v1), and while it’s not very flashy it does a few things pretty well. In addition to being able to track multiple addresses per person, it also provides a Christmas List function that we use on an annual basis to get all of our cards out.

Recently, the primary volume on my Apache web server stopped working. It was the first SSD to fail on me, and unlike traditional hard drives there was no warning and the failure was absolute. I had backups of all the live data and the web sites, but I also took this as an opportunity to upgrade to the latest version of everything so there would be some reconfiguring needed.

My database resides in /var/lib/mysql/myaddressbook; unfortunately, while I had a copy of this filesystem there were no dump files available. As it turns out, restoring was extremely easy – after stopping MySQL simply copy the directory of data files into place:

cp /mnt/backup/var/lib/mysql/myaddressbook/* /var/lib/mysql/myaddressbook/

Verify that mysql owns the files and then bring the database back online:

service mysql start

Amazingly enough, MySQL will detect the MRD data files and bring everything back to life. Once the system was online, use the mysql client to verify the data structures are ok:

mysql> check table person;
+----------------------+-------+----------+----------+
| Table                | Op    | Msg_type | Msg_text |
+----------------------+-------+----------+----------+
| myaddressbook.person | check | status   | OK       |
+----------------------+-------+----------+----------+

After completing this, I added my web user back again:

grant all privileges on myaddressbook.* to 'myuser' identified by 'topsecret';

For the web app to work, I’m using virtual hosts and these are configured by creating conf files in apache2/sites-available and then enabling these with symbolic links to sites-enabled.

Since PHP is required, this needs to be installed:

apt-get install libapache2-mod-php5

This PHP application is an older site, so the tags use the shorter form “<?”, and this is no longer a default configuration. If this format is not enabled, Apache will return the raw PHP rather than interpreting the scripted content. Enabling the short tag PHP format is relatively straightforward:

vi /etc/php5/apache2/php.ini

Look for “short_open_tag” and set this to “On”, after restarting Apache the application should work.

Categories: Technology