At least twice, now, I've encountered problems (read: apache segfaults, oh noes!) with mod_auth_mysql on Ubuntu 64-bit installs, most recently using Jaunty Jackalope (9.04) -- the most recent release (at least until 9.10 comes out soon). In searching for solutions, I discovered that this issue has been reported at least a couple times, the issue has been identified (and is a super-simple fix), and a working patch exists... but as of the writing of this article, the fix has not yet been compiled into the repo packages.
So then this becomes one of those relatively rare times that I will compile my own package. I prefer to compile binary packages (deb files) rather than simply compiling from source and doing a "make install," since packages leverage the package management system for things like dependencies and upgrades. For instance, if Ubuntu does release the fix in the next version of mod_auth_mysql, I want to be able to seemlessly upgrade to the next version.
I'm going to describe the steps to fix mod_auth_mysql 4.3.9-11, but this general process should work for applying community patches and building deb files in general.
$ sudo apt-get remove libapache2-mod-auth-mysql
Get mod_auth_mysql source (drops it in the current directory, so be where you want it, such as ~/src):
$ sudo apt-get source libapache2-mod-auth-mysql
Get dependencies for building from source:
$ sudo apt-get build-dep libapache2-mod-auth-mysql
Get a dependencies that didn't install with build-dep:
$ sudo apt-get install apache2-threaded-dev
(could be different for your system)
Get devscripts package to make this all much easier:
$ sudo apt-get install devscripts
(installs postfix -- annoying)
Set file perms on the source files you downloaded:
$ sudo chown -R josh:josh *
Enter src dir:
$ cd mod-auth-mysql-4.3.9
Prepare to apply patch. This actually starts a new shell with the current directory containing a copy of the code so you can edit it.
$ dpatch-edit-patch -a fix_segfaults
Apply patch, a one-line edit to mod_auth-mysql.c described here.
Exit the shell.
Add fix_segfaults to the end of debian/patches/00list.
Record the changes and change the package version info. Change the version at the top of the file. I usually just add something at the end of the existing version string.
$ dch -i
Build the deb file. This will compile the source, package the binaries, and put the deb file one directory up.
$ dpkg-buildpackage -rfakeroot
Install the new package. Note: Your deb file name will be different based on how you changed the version string above.
$ sudo dpkg -i ../libapache2_mod_auth_mysql-4.3.9-11_amd64.deb
Seems like a lot, but after you do it, it doesn't seem too bad, and you can bask in the glory of creating your own package -- which is reusable on all same-type systems.