在 PHP 安装上启用 Mcrypt
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8271408/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Enable Mcrypt on PHP Install
提问by justacoder
I have PHP 5.2.14 installed on a Windows box (installed via .msi) using Apache 2.2.16. The install came with both ext/php_mcrypt.dll and libmcrypt.dll but when I uncommented extension=php_mcrypt.dllin php.ini and restarted Apache it doesn't enable. phpinfo() shows nothing for it. What am I missing?
我在使用 Apache 2.2.16 的 Windows 机器上安装了 PHP 5.2.14(通过 .msi 安装)。安装随附 ext/php_mcrypt.dll 和 libmcrypt.dll,但是当我在 php.ini 中取消注释extension=php_mcrypt.dll并重新启动 Apache 时,它无法启用。phpinfo() 没有显示任何内容。我错过了什么?
UPDATE:
更新:
I looked at my error logs and it spit this out to me:
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\PHP5\ext\php_mcrypt.dll' - The specified module could not be found.\r\n in Unknown on line 0
我查看了我的错误日志,它向我吐槽:
PHP 警告:PHP 启动:无法加载动态库 'C:\PHP5\ext\php_mcrypt.dll' - 找不到指定的模块。\r\n在未知的第 0 行
I read up a bit about this and I don't have any php dll's stored in the windows32/ folder, so I'm confused.
我读了一点关于这个,我没有在 windows32/ 文件夹中存储任何 php dll,所以我很困惑。
采纳答案by justacoder
I figured it out through a combination of tutorials:
我通过组合教程想出了它:
- Added libmcrypt.dll to the System32 folder
- Uncommnted the include_path var in php.ini and added the path to ext
- Restarted Apache
- 将 libmcrypt.dll 添加到 System32 文件夹
- 取消 php.ini 中的 include_path var 并添加到 ext 的路径
- 重启阿帕奇
Thankfully, no system reboot was required. Whether one or both of the above was necessary, it doesn't matter now that mcrypt is functioning. Thanks, everyone.
幸运的是,不需要重新启动系统。无论上述一项还是两项是必要的,现在 mcrypt 正在运行都无关紧要。谢谢大家。
回答by nemozhp
The other answers has the necessary steps about check the \ext\php_mcrypt.dll
exists and enable the extension in php.ini
. Beside this, you need to copy {Your-PHP-Root}\libmcrypt.dll
to {Your-Apache-Root}\bin
, then restart apache, the problem should be solved.
其他答案包含有关检查是否\ext\php_mcrypt.dll
存在并在php.ini
. 除此之外,还需要复制{Your-PHP-Root}\libmcrypt.dll
到{Your-Apache-Root}\bin
,然后重启apache,问题就解决了。
回答by NotGaeL
You need to install it first, or maybe add the route to the library to your windows PATH enviroment variable, since you are working on windows. Try: http://www.php.net/manual/en/mcrypt.installation.php
您需要先安装它,或者可能将到库的路由添加到您的 Windows PATH 环境变量中,因为您正在 Windows 上工作。试试:http: //www.php.net/manual/en/mcrypt.installation.php
(There you can read "If you wish to install mcrypt on Windows, you should also place libmcrypt.dll in the PATH of your system.")
(在那里您可以阅读“如果您希望在 Windows 上安装 mcrypt,您还应该将 libmcrypt.dll 放在您系统的 PATH 中。”)
How to set or edit an enviroment variable: http://www.support.tabs3.com/main/R10463.htm
如何设置或编辑环境变量:http: //www.support.tabs3.com/main/R10463.htm