致命错误:调用未定义的函数mcrypt_encrypt() [英] Fatal error: Call to undefined function mcrypt_encrypt()

查看:563
本文介绍了致命错误:调用未定义的函数mcrypt_encrypt()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

注意: MCrypt支持所依赖的库多年没有更新,因此MCrypt不应再被视为一种可行或安全的加密数据方法.此外,MCrypt在PHP 5中已被弃用,在PHP 7中已被完全删除.如果您有运行MCrypt的任何代码,则应重构它以使用更现代的加密库.

NOTE: The libraries MCrypt support depend on have not been updated in years and MCrypt should no longer be considered a viable or secure method of encrypting data. What's more, MCrypt has been deprecated in PHP 5, and removed entirely in PHP 7. If you have any code that runs MCrypt you should refactor it to use a more modern encryption library.

有人知道为什么我在下面运行以下代码时显示此错误消息:(Call to undefined function mcrypt_encrypt() )吗?

Does anyone know why this error message: (Call to undefined function mcrypt_encrypt() ) displays when I run the following code below?

我是否缺少一些步骤,也许我需要在PHP中进行任何设置才能使这段代码起作用?

Am I missing some steps perhaps any setting in PHP I have to do before this code can work?

$key = 'password to (en/de)crypt';
$string = 'string to be encrypted';

$test = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key),
            $string, MCRYPT_MODE_CBC, md5(md5($key)));

推荐答案

在PHP 5.2.8版中对我有用的是打开php.ini并通过删除;允许php_mcrypt.dll扩展,即更改:

What had worked for me with PHP version 5.2.8, was to open up php.ini and allow the php_mcrypt.dll extension by removing the ;, i.e. changing:

;extension=php_mcrypt.dllextension=php_mcrypt.dll

这篇关于致命错误:调用未定义的函数mcrypt_encrypt()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆