PHP extension ext-mcrypt * is missing from your system - SOLVED

Issue

When installing PHP on your Linux system (LAMP), you may need to add some extensions depending on what you need.  For example when using Magento2, you will need extensions like mcrypt and curl.  All these extension can be typically installed by the following command.

sudo apt-get install php5-<EXTENSION>

However, you may have issues when installing php5-mcrypt.

Solution

Firstly simply install the extension and restart apache...

sudo apt-get install php5-mcrypt
sudo service apache2 restart

If this doesn't work try the following...

sudo apt-get install php5-mcrypt
sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available
sudo php5enmod mcrypt
sudo service apache2 restart