4

How to install the mcrypt modules on PHP?

I need to install the mcrypt extension on WAMPServer so that I can use IDEA encryption on passwords. I can't use any other type of encryption, because the large database I am interacting with already uses IDEA encryption on passwords.

I have done quite a bit of research on installing the mcrypt extension on PHP. I saw that there were 2 main steps:

  1. Install the extension
  2. Refer to the directory where the algorithms and modes are located in the php.ini file

Step 1 I have managed to complete successfully as it no longer gives the fatal error: "Call to undefined function mcrypt_encrypt..."

Step 2 is where I am having issues, because now when I call the mcrypt_encrypt function php returns the warning: "Warning: mcrypt_encrypt(): Module initialization failed..."

I placed the directory with all the algorithms and modes (libmcrypt) in the php extensions folder and then in php.ini I wrote these 2 lines:

mcrypt.algorithms_dir = "c:/wamp/bin/php/php5.4.3/ext/libmcrypt/modules/algorithms"

mcrypt.modes_dir = "c:/wamp/bin/php/php5.4.3/ext/libmcrypt/modules/modes"

I then restarted WAMPServer and it gave the warning: "PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.4.3/ext/php_mcrypt.dll' - The specified module could not be found."

I have been searching all over the web for tutorials on how to install the mcrypt extension and I can't find any! So I came to good old StackOverflow in hopes that someone might be able to help?

Scott Hallauer
  • 389
  • 2
  • 8
  • 16
  • I don't have a libmcrypt.dll file... Do you mean the php_mcrypt.dll, or am I missing something? – Scott Hallauer Oct 12 '12 at 14:57
  • It still isn't working! I downloaded that file and placed it in the apache bin directory and in the php5.4.3 directory. I then updated the php.ini to point to this location... And it still gives me the same error!! `phpinfo` says that mcrypt is enabled... Do you have any other suggestions, maybe a tutorial on this? – Scott Hallauer Oct 12 '12 at 17:59
  • Actually, it is working now... Just not with IDEA encryption! Do you know a download link for IDEA? – Scott Hallauer Oct 12 '12 at 18:50
  • I have restarted Apache 3 times now and `print_r(mcrypt_list_algorithms());` returns `Array ( [0] => cast-128 [1] => gost [2] => rijndael-128 [3] => twofish [4] => cast-256 [5] => loki97 [6] => rijndael-192 [7] => saferplus [8] => wake [9] => blowfish-compat [10] => des [11] => rijndael-256 [12] => serpent [13] => xtea [14] => blowfish [15] => enigma [16] => rc2 [17] => tripledes [18] => arcfour )` No IDEA listed... – Scott Hallauer Oct 12 '12 at 19:58

1 Answers1

1

Suggestion 1:

libmcrypt.dll isn't available to Apache/php_mcrypt.dll. Guess we should have checked phpinfo() first! mcrypt is available

Suggestion 2:

print_r(mcrypt_list_algorithms()); should show IDEA algorithm... since it's not a free algorithm (although the patent expired in May/2011) it may not be included .. IDEA algorithm isn't listed as available

Suggestion 3:

You're not going to enjoy this, but all I'm reading suggests you have to build PHP yourself (well first mcrypt with IDEA, then php with MCRYPT) which on Windows will be a bit of a pain (not having all the default compilers etc built in like Linux). As an alternative you could look around for a windows PHP binary version that includes MCRYPT/IDEA.. looks like some of them include it (an old version, a 64 bit version, a VC9 version). Unfortunately people have ideas in install guides/discussions about it so it's tricky to find documentation as to whether the IDEA algorithm is included ;)

Community
  • 1
  • 1
Rudu
  • 15,682
  • 4
  • 47
  • 63