简体   繁体   English

未在服务器上启用PHP扩展名mcrypt

[英]PHP extension mcrypt is not enabled on server

I'm modifying a plugin in wordpress. 我正在修改wordpress中的插件。 The plugin is "RegistrationMagic", when I inhaled it and went to the screen it appeared the following message "PHP extension mcrypt is not enabled on server". 插件为“ RegistrationMagic”,当我将其吸入并转到屏幕时,它显示以下消息“服务器上未启用PHP扩展名mcrypt”。

I tried to follow the hint of that question " https://askubuntu.com/questions/460837/mcrypt-extension-is-missing-in-14-04-server-for-mysql " 我试图遵循该问题的提示“ https://askubuntu.com/questions/460837/mcrypt-extension-is-missing-in-14-04-server-for-mysql

But when I get to that part: 但是当我谈到那部分时:

Sudo ln -s /etc/php5/mods-available/mcrypt.ini /etc/php5/cli/conf.d/20-mcrypt.ini
Sudo ln -s /etc/php5/mods-available/mcrypt.ini /etc/php5/apache2/conf.d/20-mcrypt.ini

Can not find conf.d file 找不到conf.d文件

Someone can help me: I already tried to reinstall php5 but it did not work either. 有人可以帮助我:我已经尝试过重新安装php5,但是它也不起作用。

EDIT 编辑

When I do a locate in myscript.so it returns this below: 当我在myscript.so中查找时,它在下面返回:

$locate mcrypt.so

/usr/lib/libmcrypt.so.4
/usr/lib/libmcrypt.so.4.4.8
/usr/lib/php5/20121212/mcrypt.so

PHP doesn't compile mcrypt by default. PHP默认不编译mcrypt。 you first have to have mcrypt installed 您首先必须安装mcrypt

You need to compile PHP with the --with-mcrypt[=DIR] parameter to enable this extension. 您需要使用--with-mcrypt[=DIR]参数编译PHP以启用此扩展。 DIR is the mcrypt install directory. DIR是mcrypt安装目录。 Make sure you compile libmcrypt with the option --disable-posix-threads 确保使用选项--disable-posix-threads编译libmcrypt

an example for enabling it on ubuntu, in terminal run the following: 在ubuntu上启用它的示例,在终端中运行以下命令:

apt-get install php5-mcrypt
mv -i /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available/
php5enmod mcrypt
service apache2 restart

here is an article on the php5enmod command: https://lornajane.net/posts/2012/managing-php-5-4-extensions-on-ubuntu 这是有关php5enmod命令的文章: https ://lornajane.net/posts/2012/managing-php-5-4-extensions-on-ubuntu

to Fix a missing mcrypt ini: 修复缺少的mcrypt ini:

sudo updatedb 
locate mcrypt.ini

Should show it located at /etc/php5/mods-available 应该显示它位于/etc/php5/mods-available

locate mcrypt.so

Edit mcrypt.ini and change extension to match the path to mcrypt.so , example: 编辑mcrypt.ini并更改扩展名以匹配mcrypt.so的路径,例如:

extension=/usr/lib/php5/20121212/mcrypt.so

Now this: 现在这个:

sudo php5enmod mcrypt

Verify that new files exists here (they should be auto created from the issue above) 验证此处是否存在新文件(应从上面的问题中自动创建它们)

ls -al /etc/php5/cli/conf.d/20-mcrypt.ini
ls -al /etc/php5/apache2/conf.d/20-mcrypt.ini

Otherwise do the following 否则请执行以下操作

Create symbol links now 立即创建符号链接

sudo ln -s /etc/php5/mods-available/mcrypt.ini /etc/php5/cli/conf.d/20-mcrypt.ini
sudo ln -s /etc/php5/mods-available/mcrypt.ini /etc/php5/apache2/conf.d/20-mcrypt.ini

Restart Apache 重新启动Apache

sudo service apache2 restart

Restart php5 or php5-fpm 重新启动php5或php5-fpm

sudo service php5 restart

Check if mcrypt is enabled or not 检查是否启用了mcrypt

php -i | grep mcrypt

Now if it displays you something related to myrypt and its version mean mcrypt is already enabled. 现在,如果它向您显示与myrypt相关的内容,并且其版本表示mcrypt已启用。 just restart your apache server and you're good to go. 只需重新启动apache服务器,一切就好了。

and i think that's your only issue, rest you know already. 我认为这是您唯一的问题,请您早已知道。

In case if it's not installed 如果没有安装

sudo apt-get install php5-mcrypt
OR
using PECL
sudo pecl install mcrypt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM