【问题标题】:Install mcrypt on OS X Yosemite在 OS X Yosemite 上安装 mcrypt
【发布时间】:2017-03-13 10:22:35
【问题描述】:

我正在尝试在本地开发人员上运行应用程序。 OS X Yosemite 上的环境,但由于未启用 mcrypt 而失败。

我从本指南开始:https://coolestguidesontheplanet.com/install-mcrypt-php-mac-osx-10-10-yosemite-development-server/

而且我已经浏览了我能找到的所有指南。

在我的 php.ini 文件中,我添加了扩展名:

; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
; extension_dir = "extension_dir=/usr/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so"
; extension=mcrypt.so

如果使用命令:

php --info | grep mcrypt\\.


Additional .ini files parsed => /usr/local/etc/php/5.5/conf.d/ext-mcrypt.ini
Registered Stream Filters => zlib.*, bzip2.*, convert.iconv.*,   string.rot13, string.toupper, string.tolower, string.strip_tags,   convert.*, consumed, dechunk, mcrypt.*, mdecrypt.*
PHP Warning:  Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Unknown on line 0
mcrypt.algorithms_dir => no value => no value
mcrypt.modes_dir => no value => no value

不知道现在该做什么。

【问题讨论】:

  • 最好不要使用mcrypt,它已经废弃了近十年了。因此,它已被弃用,并将在 PHP 7.2 中从核心中移除并进入 PECL。它不支持标准 PKCS#7 (née PKCS#5) 填充,仅支持甚至不能用于二进制数据的非标准空填充。 mcrypt 有许多可追溯到 2003 年的突出错误。请考虑使用 defuseRNCryptor,它们提供了完整的解决方案,正在维护并且是正确的。

标签: php macos


【解决方案1】:

如果您可以使用 Homebrew,这很容易。从终端运行以下命令。

brew install autoconf
brew install mcrypt

重启 Apache

sudo apachectl restart

有关其他可用方法,请参阅此answer

【讨论】:

  • 嗨!两者都给了我“已经安装”。我的 phpinfo 文件不会显示 mcrypt。
【解决方案2】:

如果您使用自制软件安装了 mcrypt,但该模块仍未显示在您的 phpinfo() 中,您可以尝试以下对我有用的方法(OS X Sierra):

编辑你的 php.ini(你可以使用 vi 或 nano 代替 atom)

sudo atom /etc/php.ini

在您的 php.ini 末尾添加以下行(您的加密版本可能不同)

extension="/usr/local/Cellar/php56-mcrypt/5.6.29_3/mcrypt.so"

重启apache

sudo apachectl restart

【讨论】:

    猜你喜欢
    • 2015-03-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-27
    相关资源
    最近更新 更多