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?

4

1 回答 1

1

建议一:

libmcrypt.dll对 Apache/ 不可用php_mcrypt.dll。我想我们应该先检查一下phpinfo()mcrypt 可用

建议二:

print_r(mcrypt_list_algorithms());应该显示 IDEA 算法...因为它不是免费算法(尽管专利于 2011 年 5 月到期),它可能不包括在内.. IDEA 算法未列为可用算法

建议三:

你不会喜欢这个,但我读到的所有内容都表明你必须自己构建 PHP首先mcrypt使用 IDEA,然后php使用 MCRYPT),这在 Windows 上会有点痛苦(没有所有默认编译器等像Linux一样内置)。作为替代方案,您可以四处寻找包含MCRYPT/IDEA 的 Windows PHP 二进制版本。看起来其中一些包含它(旧版本、64 位版本、VC9 版本)。 不幸的是,人们在安装指南/讨论中对此有想法,因此很难找到关于IDEA算法是否包含在内的文档;)

于 2012-10-12T20:19:58.997 回答