Well, if your PHP applications tells you that Mcrypt is not installed there is a simple trick to solve this. Most of you will not come to this page to see this trick, because it is common knowledge.

Try this.

sudo apt-get install php5-mcrypt

And what if you get a super simple return like this?

$ sudo apt-get install php5-mcrypt
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    php5-mcrypt is already the newest version.
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Well, in that case you came to the right place. Mcrypt is already installed on your server, only Apache doesn’t know where it is hiding!
Follow these steps to fix this ridiculous annoying problem:

sudo updatedb 
locate mcrypt.ini

Should show it located at /etc/php5/mods-available

locate mcrypt.so

Edit mcrypt.ini and change extension to match the path to mcrypt.so, example:


Now this:

php5enmod mcrypt

Verify that new files exists here

ls -al /etc/php5/cli/conf.d/20-mcrypt.ini
ls -al /etc/php5/apache2/conf.d/20-mcrypt.ini

If they don’t you will have to do it yourself, create symbol links like this:

ln -s /etc/php5/mods-available/mcrypt.ini /etc/php5/cli/conf.d/20-mcrypt.ini
ln -s /etc/php5/mods-available/mcrypt.ini /etc/php5/apache2/conf.d/20-mcrypt.ini

Restart Apacahe

service apache2 restart

And that my friends, will have fixed your problem. Questions? Comment!