missing mcrypt – Fatal Error: Undefined function mcrypt_encrypt()! in Ubuntu 13.10/14.04

I came across this problem when I upgraded my Ubuntu to 14.04. I have used php-mycrypt in one of my project which was working fine until my ubuntu got upgraded and now when I try to access my project I get this Fatal Error
Fatal Error: Undefined function mcrypt_encrypt()
The solution looks simple but it took me ages to figure out and after a lot of googling around (most of the solution provided didn't help me at all ) so I thought I will share this hoping that you guys end up here quickly and don't have to spend much of your time (like I did ) :):) and hoping this will help you guys.

So, without wasting much of your time. Let me begin, First thing to do is see if you have installed php5-mcrypt (like everyone does), you can do that by:
sudo apt-get install php5-mcrypt
It should install mycrypt and if already installed, you will get the following message:
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 13 not upgraded.
Looks good till now but wait a second, I still get that undefined fatal error. so what now,
see your ini file is in correct path. If not then move it (not neccessary if it is already there)
$mv /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available/
Enable mcrypt module. run the following command to enable it:
sudo php5enmod mcrypt
Restart Apache
sudo service apache2 restart
Try it out now And HOlA!!!!! IT works.

Hope it helped. Feel free to comment or you have any concerns or you know any other way :). Let us help each other and yes Happy coding.


Post a Comment

Popular posts from this blog

jquery attr() vs prop() (difference)

jQuery popup (dialog) form validation on a normal button click

Close jQuery Dialog Box when clicked outside of the dialog popup