Fixing Call to Undefined Function mcrypt_module_open PHP

While working on a Magento-based store, I cam across this error:

Fatal error: Call to undefined function mcrypt_module_open() in /path/to/Magento/site/lib/Varien/Crypt/Mcrypt.php on line 63

I had never encounter this error before, so I did a quick search, and found out that the problem was a missing module on php. The missing module was mCrypt.

Running phpinfo() confirmed that the module was not installed. Once I knew that, it was just a matter of installing that module, and restarting the apache server.

To install mCrypt on Ubuntu is very simple:

sudo apt-get install php5-mcrypt

And to restart apache:

sudo /etc/init.d/apache2 restart

This solves the problem.

Useful sources:
http://techwhet.jduy.com/2009/09/ubuntu-php-mcrypt-installation.html
http://ubuntuforums.org/showthread.php?t=698084