How To get php5-mcrypt enabled / php5-mcrypt installed but not working Ubuntu 14.04

Hi! Yes this blog is alive, and the author is alive too.

Recently while dealing with some encryption code in php, I faced this problem – I had checked out code that a colleague had written and was making some changes.  While running it, the code wouldn’t work as long as the encryption part of the code was included.  Comment it out and the rest of the pieces were working fine. And digging deeper, I realized that probably, encryption modules where not installed yet – because the code was failing exactly at

 mcrypt_module_open(MCRYPT_RIJNDAEL_128, ”,’cbc’, ”);

I did the following to fix this:-

Environment – Ubuntu 14.04 – Nginx+php5-fpm with Nginx connecting to php5-fpm via unix socket

With a little help from Ubuntu Forums – Ran this command

 dpkg –get-selections | grep php

And got this as the output –

php5-common install
php5-curl install
php5-fpm install
php5-json install
php5-mysql install

 This command lists the modules/libraries installed in our systems – and this clearly showed that the php5-mcrypt module was not even present.

I did

sudo apt-get install php5-mcrypt

and after the installation,

sudo service php5-fpm restart

But this still dint work. Finally the fix mentioned in this link worked for me –

and a sudo service php5-fpm restart

And it finally worked.


About vatsalad

Hi, I'm Vatsala
This entry was posted in How To..., Uncategorized and tagged , . Bookmark the permalink.