douyi8315
2018-05-15 16:05
浏览 209
已采纳

如何ubuntu 18.04安装/激活PHP扩展ext-mcrypt

I am installing a fresh kubuntu system 18.04, which is using by default php7.2

A composer install for my current software project gibves me this error message:

The requested PHP extension ext-mcrypt * is missing from your system. Install or enable PHP's mcrypt extension.

Other than before there is no php-mcrypt available and other articles like this http://aryo.lecture.ub.ac.id/easy-install-php-mcrypt-extension-on-ubuntu-linux/ don't help since an analog php-mcrypt or php7-mcrypt does not exists.

How can I get a setup, which fulfills my requirement?

sudo apt-get install php7.2-ext-mcrypt

does not find an installation candidate.

Is there a difference between php 7.1 and 7.2?

not surprisingly this also does not do the trick:

$ sudo phpenmod mcrypt
WARNING: Module mcrypt ini file doesn't exist under /etc/php/7.2/mods-available
WARNING: Module mcrypt ini file doesn't exist under /etc/php/7.2/mods-available

图片转代码服务由CSDN问答提供 功能建议

我正在安装一个新的kubuntu系统18.04,默认使用php7.2 \ n

我当前软件项目的作曲家安装错误消息:

系统中缺少所请求的PHP扩展名ext-mcrypt *。 安装或启用PHP的mcrypt扩展。

除了没有可用的php-mcrypt和其他类似的文章 http://aryo.lecture.ub.ac.id/easy-install- php-mcrypt-extension-on-ubuntu-linux / 没有帮助,因为模拟的php-mcrypt或php7-mcrypt不存在。

我怎样才能获得 设置,满足我的要求?

  sudo apt-get install php7.2-ext-mcrypt 
   
 
 

没有找到安装候选者。

php 7.1和7.2之间有区别吗?

并不奇怪 gly这也不起作用:

  $ sudo phpenmod mcrypt 
警告:/etc/php/7.2/mods-available \下不存在模块mcrypt ini文件 n警告:/etc/php/7.2/mods-available
下不存在模块mcrypt ini文件
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dongxi5423 2018-05-16 11:51
    已采纳

    So it looks like mcrypt is deprecated with php7.2

    So I will either have to replace it in my software or follow e.g. this howto to circumvent it: https://serverpilot.io/community/articles/how-to-install-the-php-mcrypt-extension.html

    已采纳该答案
    打赏 评论
  • douzhizao0270 2019-01-17 06:24

    First Check whether the mcrypt PHP module is present:

    $ php -m | grep mcrypt
    

    To install the mcrypt PHP module we first need to satisfy the following prerequisites:

    sudo apt install php-dev libmcrypt-dev php-pear
    

    Now we are ready to install mcrypt PHP module on our Ubuntu 18.04 system:

    $ sudo pecl channel-update pecl.php.net
    $ sudo pecl install mcrypt-1.0.1
    

    Open the /etc/php/7.2/cli/php.ini file and insert:

    extension=mcrypt.so
    

    All done. When successful, checking for the presence of the mcrypt PHP module should produce the following output:

    $ php -m | grep mcrypt
    mcrypt
    

    The mcrypt extension is included in PHP 5.4 through PHP 7.1. It was removed from PHP 7.2 and moved to an unofficial PECL extension because the mcrypt library is no longer maintained.

    For PHP 7.2+, PHP instead uses libsodium as a cryptography library. ServerPilot builds PHP 7.2+ with the official libsodium extension. New PHP code should be written to use libsodium rather than mcrypt.

    How to install mcrypt on PHP 7.2 or 7.3: https://serverpilot.io/docs/how-to-install-the-php-mcrypt-extension

    打赏 评论

相关推荐 更多相似问题