Remove PHP Warning “Unable to load dynamic library” mhash after upgrading Ubuntu

After upgrading Ubuntu to 10.04 (give or take a version), you might notice the following warning (or variant) thrown by PHP5:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/mhash.so' - /usr/lib/php5/20090626/mhash.so: cannot open shared object file: No such file or directory in Unknown on line 0

This is the result of the latest version of PHP already having mhash included in the php5-common package.   Even though php5-mhash got removed in the upgrade, the mhash.ini file still references it (and the warning gets thrown).

To fix this, you’ll need to comment out the following line in /etc/php5/cli/conf.d/mhash.ini :

extension=mhash.so

This is a hack, but it removes the tiresome warning.