开发者社区> 问答> 正文

centos php安装mcrypt扩展报错 Module 'mcrypt' a?报错

打算在服务器上设置一个计划任务定时执行一个php文件,测试的时候发现需要mcrypt支持,于是就安装了mcrypt扩展,php -m 查看确定已加载mcrypt扩展。

  使用phpinfo查看如下信息:

 

  用命令执行php文件报一下错误:

请教一下是什么问题!

展开
收起
爱吃鱼的程序员 2020-06-22 13:19:47 592 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    mcrypt模块,需要在编译php前启用,不能使用动态加载方式(因为它依赖libmcrypt),具体方法是:

    1. 先安装libmcrypt,

    这个库并不包含在Redhat(CentOS实测也并未包含)的YUM源中,需要单独安装,这里以安装libmcrypt-2.5.7为例。
    Libmcrypt下载地址:http://mcrypt.hellug.gr/lib/index.html

    tar -xf  libmcrypt-2.5.7.tar.gz

    cd  libmcrypt-2.5.7/libltdl/

    ./configure  --enable-ltdl-install && make && make install

    cd ..

    ./configure && make && make install


    2.编译安装php时指定参数 --with-mcrypt 即可
    libmcrypt这个已经安装了。有哪位知道的,拜托请指教一下。

    http://ubuntuforums.org/showthread.php?t=2152999

    Yes,itlookslikeyouhavetwofilesthatbothtrytoinstallmcrypt.Theofficialrepositoryfilesallstartwithanumberthatcontrolstheorderofloading.Renamethefilecalled"mcrypt.ini"to"mcrypt.extra"thenrestartApacheorrunphp5fromthecommandlineandseeifyoustillgettheerror.Ifnot,andphpinfo()or"php-i"fromthecommandlineshowmcryptisstillinstalled,thendeletethe"extra"file.

    按照字面的意思就是‘ mcrypt’模块加载了多次。

    你看你的php配置文件,是不是自己手动添加了 extension和php的conf.d目录中都有加载 mcrypt.so或者 mcrypt.dll

    引用来自“pxv”的答案

    按照字面的意思就是‘ mcrypt’模块加载了多次。

    你看你的php配置文件,是不是自己手动添加了 extension和php的conf.d目录中都有加载 mcrypt.so或者 mcrypt.dll

    这个看不出来,要看配置文件。

    引用来自“kenping”的答案

    http://ubuntuforums.org/showthread.php?t=2152999

    Yes,itlookslikeyouhavetwofilesthatbothtrytoinstallmcrypt.Theofficialrepositoryfilesallstartwithanumberthatcontrolstheorderofloading.Renamethefilecalled"mcrypt.ini"to"mcrypt.extra"thenrestartApacheorrunphp5fromthecommandlineandseeifyoustillgettheerror.Ifnot,andphpinfo()or"php-i"fromthecommandlineshowmcryptisstillinstalled,thendeletethe"extra"file.
    那个是配置文件自动加载目录里面所有的INI配置文件都会自动加载这个目录在PHPINFO里也能看到的
    2020-06-22 13:20:05
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
阿里云栖开发者沙龙PHP技术专场-深入浅出网络编程与swoole内核-吴镇宇 立即下载
PHP安全开发:从白帽角度做安全 立即下载
PHP 2017.北京 全球开发者大会——高可用的PHP 立即下载