2015-10-02 47 views
3

將「Yosemite」更新爲「El Capitan」後,mcrypt擴展出現問題。將OSX更新爲「El Capitan」後未定義函數mcrypt

Fatal error: Call to undefined function mcrypt_decrypt() in /Users/Pilipe/Sites/prestashop-test/classes/Rijndael.php on line 68

在我的php.ini,我加入這一行:

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

當我啓動此命令行:

php -i | grep 'mcrypt'

我:

Additional .ini files parsed => /usr/local/etc/php/5.6/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
mcrypt support => enabled
mcrypt_filter support => enabled
mcrypt.algorithms_dir => no value => no value
mcrypt.modes_dir => no value => no value
PWD => /usr/local/Cellar/php56-mcrypt/5.6.13
_SERVER["PWD"] => /usr/local/Cellar/php56-mcrypt/5.6.13

命令php -v:

PHP 5.6.13 (cli) (built: Oct 2 2015 23:07:16)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

我安裝了mcrypt的:

brew install php56-mcrypt

我這樣做:

brew link php56-mcrypt

爲什麼這個Mcrypt它不工作?

預先感謝您。
真誠的菲利普。

+0

您是否解決了您的問題?因爲我有同樣的問題。 –

+0

沒有對不起,我禁用了「SIP」,但我仍然有同樣的問題。 – Pilipe

+0

看看我的答案在這裏http://stackoverflow.com/questions/32908829/error-in-mcrypt-after-upgrading-into-el-cap-capitan-os – Zakaria

回答

1

我能夠通過卸載Homebrew,重新安裝Homebrew然後安裝php 5.6 mcrypt軟件包來解決此問題。這種方法相對於Pilipe解決方案的優點是不需要禁用新的系統完整性保護(SIP)。

// Uninstall Homebrew 
[sudo] rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup 

// Reinstall Homebrea 
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 

// Install mcrypt 
brew install php53-mcrypt 

// Test mcrypt 
mcrypt -v 
// should result in 
// Mcrypt v.0.9.9 (i386-apple-darwin15.0.0) 
// Linked against libmcrypt v.2.5.8 
// Copyright (C) 1998-2002 Nikos Mavroyanopoulos ([email protected])