doumeng3345 2018-09-21 11:05
浏览 53

无法让mcrypt在OS X High Sierra和PHP 7.1上工作

I need to use a Wordpress 3rd party plugin that uses mcrypt. mcrypt is not available as default in my environment (OSX High Sierra and PHP 7.1) (and I know that it is deprecated...) so I installed it with PECL. The installed mcrypt.so file was created in this location:

/usr/lib/php/extensions/no-debug-non-zts-20160303/

I have added the following to my php.ini:

extension=/usr/lib/php/extensions/no-debug-non-zts-20160303/mcrypt.so

And after that

php -i | grep mcrypt

returns

Registered Stream Filters => zlib.*, bzip2.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, mcrypt.*, mdecrypt.*
mcrypt
mcrypt support => enabled
mcrypt_filter support => enabled
mcrypt.algorithms_dir => no value => no value
mcrypt.modes_dir => no value => no value

And

php -m | grep mcrypt

returns

mcrypt

To me this means that php now can use mcrypt.

I restart Apache, but still get a fatal error:

**Fatal error**: Uncaught Error: Call to undefined function mcrypt_module_open() in /User.....

And displaying a page with

<?php phpinfo(); ?>

does NOT show mcrypt among the modules. But IT IS the correct php.ini that is used. So to me this means that php can use mcrypt when started from the command line but not when used from Apache.

I also tried to uncomment the line

LoadModule php7_module libexec/apache2/libphp7.so

in httpd.conf, and restart apache, but the result is the same.

Any ideas?

  • 写回答

1条回答 默认 最新

  • doufei2194 2018-09-28 10:21
    关注

    As it turned out, this was a problem with Apache+PHP. I re-installed both Apache and PHP following the advice from here https://getgrav.org/blog/macos-sierra-apache-upgrade-homebrew (which since has been updated for the new version OSX 10.14 Mojave) and here: https://getgrav.org/blog/macos-mojave-apache-multiple-php-versions

    I site from the former site:

    The cleanest way to migrate from the old brew formulae to the new pecl package approach is to remove everything PHP-related and reinstall with the new instructions.

    评论

报告相同问题?

悬赏问题

  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题