mcrypt_create_iv not working anymore on apache2 after ubuntu upgrade

1.6k Views Asked by At

Recently I had updated from Xubuntu 12 to 14.04. After programming for a while i needed to use the mcrypt function to help generate a salt. To my frustration, the same script that once worked worked no longer

 $salt = base64_encode(mcrypt_create_iv(24, MCRYPT_DEV_URANDOM));

Would now break my script.

1

There are 1 best solutions below

0
Ulad Kasach On

I found the answer after a tedious search.

 mv -i /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available/
 sudo php5enmod mcrypt
 sudo service apache2 restart

Now - I only needed to enable the script as mcrypt.ini was already in mods-available, but i will leave that part in because it may help someone else.

Source: http://www.devraju.com/about-me/ubuntu-13-1014-04-mcrypt-missing-fatal-error-undefined-function-mcrypt_encrypt/#comment-839735