php 调用未定义的函数 mcrypt_decrypt() - 即使安装了 php5-mcrypt
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20872597/
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
Call to undefined function mcrypt_decrypt() - even when php5-mcrypt installed
提问by Matthew 'mandatory' Bryant
So I can't stop getting the error:
所以我不能停止收到错误:
PHP Fatal error: Call to undefined function mcrypt_decrypt() in
Even when I have php5_mcrypt installed, I've reinstalled php quite a few times but I can't get it working!
即使我安装了 php5_mcrypt,我也重新安装了 php 好几次,但我无法让它工作!
More info:
更多信息:
mandatory@mandatorys-box:~/Desktop/bots$ dpkg -l | grep php
ii libapache2-mod-php5 5.5.3+dfsg-1ubuntu2.1 amd64 server-side, HTML-embedded scripting language (Apache 2 module)
ii php5 5.5.3+dfsg-1ubuntu2.1 all server-side, HTML-embedded scripting language (metapackage)
ii php5-cli 5.5.3+dfsg-1ubuntu2.1 amd64 command-line interpreter for the php5 scripting language
ii php5-common 5.5.3+dfsg-1ubuntu2.1 amd64 Common files for packages built from the php5 source
ii php5-curl 5.5.3+dfsg-1ubuntu2.1 amd64 CURL module for php5
ii php5-json 1.3.1+dfsg-2 amd64 JSON module for php5
ii php5-mcrypt 5.4.6-0ubuntu3 amd64 MCrypt module for php5
ii php5-mysql 5.5.3+dfsg-1ubuntu2.1 amd64 MySQL module for php5
ii php5-readline 5.5.3+dfsg-1ubuntu2.1 amd64 Readline module for php5
No idea what the problem is, tried everything.
不知道是什么问题,什么都试过了。
More info:
更多信息:
mandatory@mandatorys-box:~/Desktop/bots$ php -v
PHP 5.5.3-1ubuntu2.1 (cli) (built: Dec 12 2013 04:24:35)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies
回答by John WH Smith
Installing is one thing. Enabling is another. Please make sure your /etc/php.inifile contains the following line :
安装是一回事。启用是另一回事。请确保您的/etc/php.ini文件包含以下行:
extension=mcrypt.so
If you can't find your php.ini, create a test.phpfile containing :
如果找不到您的php.ini,请创建一个test.php包含以下内容的文件:
<?php phpinfo(); ?>
Execute it with php test.php | grep ".ini", and you'll find the paths to your ini files. One of them must include the extension=line above.
用 执行它php test.php | grep ".ini",你会找到你的 ini 文件的路径。其中之一必须包括extension=上面的行。
回答by Chris
You may have to enable the module. On Ubuntu systems this can most easily be done by linking the inifile that ships with php5-mcryptinto your conf.dfor each PHP binary you want to use:
您可能必须启用该模块。在 Ubuntu 系统上,这可以通过将ini随附的文件链接php5-mcrypt到您conf.d要使用的每个 PHP 二进制文件中来轻松完成:
sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/cli/conf.d/mcrypt.ini
sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/cgi/conf.d/mcrypt.ini

