mcrypt安装问题 [英] problem with mcrypt installation
问题描述
我已要求系统管理员在服务器上安装 mcrypt ,他们说一切正常。但是当我运行我的简单脚本,我得到这个。
I've asked the system admins to install mcrypt on the server, and they say everything is OK. But when I run my simple script I get this.
警告:mcrypt_get_iv_size()[function.mcrypt-get-iv-size]模块初始化失败
Warning: mcrypt_get_iv_size() [function.mcrypt-get-iv-size]: Module initialization failed
来自此行:
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256,MCRYPT_MODE_ECB);
现在,从这段代码:
$algorithms = mcrypt_list_algorithms("/usr/local/bin/mcrypt");
foreach ($algorithms as $cipher) {
echo "$cipher<br />\n";
}
我得到:
警告:mcrypt_list_algorithms()[function.mcrypt-list-algorithms]:在模块dir中找不到算法
Warning: mcrypt_list_algorithms() [function.mcrypt-list-algorithms]: No algorithms found in module dir
当我运行时:
$modes = mcrypt_list_modes("/usr/local/bin/mcrypt");
foreach ($modes as $mode) {
echo "$mode <br />\n";
}
我得到:
警告:mcrypt_list_modes()[function.mcrypt-list-modes]:在模块dir中找不到任何模式
Warning: mcrypt_list_modes() [function.mcrypt-list-modes]: No modes found in module dir
但是,运行此命令此命令
However, running this command this command
which mcrypt; mcrypt -v
产生:
/usr/local/bin/mcrypt
Mcrypt v.0.9.9 (x86_64-unknown-linux-gnu)
Linked against libmcrypt v.2.5.7
Copyright (C) 1998-2002 Nikos Mavroyanopoulos (nmav@gnutls.org)
mcrypt 安装/配置是否正确?
Is mcrypt installed/configured correctly?
UPDATE:
我这样做:
whereis libmcrypt
。得到结果:
libmcrypt: /usr/local/lib/libmcrypt /usr/local/lib/libmcrypt.so /usr/local/lib/libmcrypt.la
我也改变了:
$modes = mcrypt_list_modes("/usr/local/bin/mcrypt");
到...
$modes = mcrypt_list_modes("/usr/local/lib/libmcrypt");
$algorithms = mcrypt_list_algorithms("/usr/local/lib/libmcrypt");
按照建议,但仍会收到错误:
As recommended, but still get the error:
警告:mcrypt_list_modes()[function.mcrypt-list-modes]:
Warning: mcrypt_list_modes() [function.mcrypt-list-modes]: No modes found in module dir in
然后我进入我的CPanel中的文件管理器 / usr / local / lib / libmcrypt
。该目录存在,但其中没有文件...
Then I went into the file manager in my CPanel to /usr/local/lib/libmcrypt
. The directory exists but it has no files in it...
Here is the print screen of the file manager.
谢谢。
推荐答案
尝试这样做,为您的mcrypt问题:
Try this for your mcrypt problem:
mv -i /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available/
sudo php5enmod mcrypt
sudo service apache2 restart
这是一个与mcrypt.ini文件位置有关的错误。
It's a bug with the location of the mcrypt.ini file.
我有同样的错误,我做了一个cp而不是一个mv
I had the same bug, I did a cp instead of a mv to be sure but it solved the problem.
对于PHP不工作,如果你得到phpmyadmin工作(即使有mcrypt错误),这意味着PHP正在工作(因为phpmyadmin使用PHP)。但在你的例子中
For PHP not working, if you get phpmyadmin working (even with the mcrypt error), it means PHP is working (because phpmyadmin uses PHP). But in your example
<? echo $row['details']; ?>
更改<?
到<?php
,然后重试?
这篇关于mcrypt安装问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!