必须加载 php 扩展 mcrypt
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26116530/
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
php extension mcrypt must be loaded
提问by Loko
I was following a tutorial online about installing magento on ubuntu but I get this error at the config: php extension mcrypt must be loaded
. I already tried: sudo apt-get install php5-mcrypt
but this didn't work for me. I had the same problem with curlbut when I tried: sudo apt-get install php5-curl
it did work for me. How do I fix this with mcrypt? I already tried to restart the webserver.
我正在在线学习有关在 ubuntu 上安装 magento 的教程,但在配置中出现此错误:php extension mcrypt must be loaded
. 我已经尝试过:sudo apt-get install php5-mcrypt
但这对我不起作用。我对curl有同样的问题,但是当我尝试时:sudo apt-get install php5-curl
它确实对我有用。如何使用 mcrypt 解决此问题?我已经尝试重新启动网络服务器。
回答by Tapaswi Panda
Hope your system is ubuntu as you added the tag.
希望您的系统在添加标签时是 ubuntu。
On Ubuntu when you run sudo apt-get install php5-mcrypt
it doesn't actually install the extension into the mods-available. You'll need to symlink it.
在 Ubuntu 上,当您运行sudo apt-get install php5-mcrypt
它时,它实际上并没有将扩展安装到 mods-available 中。您需要对其进行符号链接。
sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available/mcrypt.ini
Then enable the extension and restart Apache.
然后启用扩展并重新启动Apache。
sudo php5enmod mcrypt
sudo service apache2 reload
回答by Coffee123
I am not sure why your PHP.INI is slightly different than mine. Or why I did not need to use PHP5ENMOD.
我不确定为什么您的 PHP.INI 与我的略有不同。或者为什么我不需要使用PHP5ENMOD。
Here is how I solved the same problem:
这是我解决同样问题的方法:
1) Make sure it is installed on my distribution, which is not the problem most people are having.
1) 确保它安装在我的发行版上,这不是大多数人遇到的问题。
2) Check the PHP configuration to make sure it is loaded (it was not). Here is the code for a PHP configuration info page:
2) 检查 PHP 配置以确保它已加载(未加载)。这是 PHP 配置信息页面的代码:
<?php
phpinfo();
?>
Run it in a browser. If MCrypt is enabled (which it is NOT), you will see a whole table dedicated to it with simmilar information (You will see this later):
在浏览器中运行它。如果 MCrypt 已启用(它不是),您将看到一个专用于它的完整表格,其中包含类似的信息(稍后您将看到):
mcrypt
mcrypt support enabled
mcrypt_filter support enabled
Version 2.5.8
Api No 20021217
Supported ciphers cast-128 gost rijndael-128 twofish arcfour cast-256 loki97 rijndael-192 saferplus wake blowfish-compat des rijndael-256 serpent xtea blowfish enigma rc2 tripledes
Supported modes cbc cfb ctr ecb ncfb nofb ofb stream
Directive Local Value Master Value
mcrypt.algorithms_dir no value no value
mcrypt.modes_dir no value no value
3) On the same page look for the location of your PHP.INI file. for example:
3) 在同一页面上查找 PHP.INI 文件的位置。例如:
Configuration File (php.ini) Path /etc/php5/apache2
Loaded Configuration File /etc/php5/apache2/php.ini
My distribution had this file in a different location, but for linux just add or uncomment so you have:
我的发行版在不同的位置有这个文件,但对于 linux 只需添加或取消注释,这样你就有:
extension=mcrypt.so
Restart your apache server to make sure. You should now check your configuration page and see the MCRYPT is loaded.
重新启动您的 apache 服务器以确保。您现在应该检查您的配置页面并看到 MCRYPT 已加载。
回答by Ashish pathak
Hi just copy this cmd lines and paste in your terminal
嗨,只需复制此 cmd 行并粘贴到您的终端中
sudo apt-get install php5-intl
sudo apt-get install php5-xsl
sudo php5enmod xsl
sudo service apache2 restart
回答by afsetiawan
In my case, using Nginx and PHP-FPM, once enabled the extention thru this command: sudo php5enmod mcrypt
I need to restart php5-fpm using this command: sudo service php5-fpm restart
就我而言,使用 Nginx 和 PHP-FPM,一旦通过以下命令启用扩展:sudo php5enmod mcrypt
我需要使用以下命令重新启动 php5-fpm:sudo service php5-fpm restart
回答by user11939933
It depends on the version of the OS you're using.
这取决于您使用的操作系统版本。
UBUNTU: sudo apt-get install php-mcrypt
乌本图: sudo apt-get install php-mcrypt
CENTOS: sudo yum install php-mcrypt
中心: sudo yum install php-mcrypt
回答by Jeroen de Jong
You should edit php.ini and remove the ; before the line where the extension=php_mcrypt is loaded (you should restart apache thereafter).
您应该编辑 php.ini 并删除 ; 在加载 extension=php_mcrypt 的行之前(此后您应该重新启动 apache)。