16

After reinstalling our server, MCRYPT is no longer working and PHP gives the notice

Use of undefined constant MCRYPT_BLOWFISH (Apache 2.4, PHP 5.5).

php -m returns mcrypt.

ls -al /etc/php5/apache2/conf.d/
20-mcrypt.ini -> ../../mods-available/mcrypt.ini

cat /etc/php5/mods-available/mcrypt.ini
; configuration for php MCrypt module
extension=mcrypt.so

Why is mcrypt not recognized? How can I make this work?

Nolwennig
  • 1,613
  • 24
  • 29
Ben Rogmans
  • 987
  • 1
  • 14
  • 22

2 Answers2

23

No sooner do I speak do I find a solution, heh.

This worked for me: mCrypt not present after Ubuntu upgrade to 13.10

needed to go: sudo php5enmod mcrypt

even though it appeared to already be enabled, that fixed it.

Community
  • 1
  • 1
phazei
  • 5,323
  • 5
  • 42
  • 46
  • 2
    "sudo php5enmod mcrypt" did the trick! For other readers: restart apache after this with the command "sudo service apache2 restart" – Ben Rogmans Jul 09 '14 at 06:15
  • this worked for my laravel/homestead vagrant box https://gist.github.com/Artistan/ee25f22f5e931b7ee46f3d6167d87e5f – Artistan Jul 09 '18 at 16:07
4

When I try to enable the Express Paypal method, I came across this error.

Error: Use of undefined constant MCRYPT_BLOWFISH - assumed MCRYPT_BLOWFISH in /var/www/.../lib/Varien/Crypt/Mcrypt.php on line 56

Firstly, we can run this cmd to check the mcrypt is running or not:

php --ri mcrypt

If mcrypt is not enabled, we can use the following to enable it as others mentioned

sudo php5enmod mcrypt

As well, we had better check php5-mcrypt package is installed or not

dpkg -l | grep php5-mcrypt

While if you install fastcgi and php-fpm like us, we have to restart the php-fpm service, and apache2 service as well.

sudo service apache2 restart
sudo service php-fpm restart
Andhi Irawan
  • 456
  • 8
  • 15
John Yin
  • 8,057
  • 4
  • 25
  • 25