Mcrypt PHP Error - Module Initialization

How to install mcrypt modules in PHP?

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

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

  • Install extension
  • Refer to the directory in which the algorithms and modes are in the php.ini file.

Step 1 I was able to successfully complete the work, because it no longer gives a fatal error: "Call the undefined function mcrypt_encrypt ..."

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

I put the directory with all the algorithms and modes (libmcrypt) in the php extensions folder, and then in php.ini I wrote these two 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"

Then I restarted WAMPServer and gave a warning: "PHP Startup: could not load the dynamic library c: /wamp/bin/php/php5.4.3/ext/php_mcrypt.dll" - the specified module was not found. "

I have searched all over the internet for tutorials on how to install the mcrypt extension, and I cannot find it! So, I came to the good old StackOverflow in the hope that someone could help?

+4
source share
1 answer

Suggestion 1:

libmcrypt.dll not available for Apache / php_mcrypt.dll . We believe that we should first check phpinfo() ! mcrypt is available

Suggestion 2:

print_r(mcrypt_list_algorithms()); should show the IDEA algorithm ... since it is not a free algorithm (although the patent expired in May / 2011), it cannot be enabled. IDEA not listed as available

Proposition 3:

You won’t like it, but everything I read suggests that you have to build PHP yourself (well, first mcrypt with IDEA, then php with MCRYPT), which on Windows will be a little painful (not having all the default compilers, etc. . on Linux). Alternatively, you can look around the binary version of Windows PHP, which includes MCRYPT / IDEA .. looks like some of them include (old version, 64 bit version , version VC9). Unfortunately, people have ideas in the installation / discussion guides, so it’s hard to find documentation about whether the IDEA algorithm is enabled;)

+1
source

Source: https://habr.com/ru/post/1439408/


All Articles