Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undefined function mcrypt after update OSX to "El Capitan"

I have a problem with mcrypt extension after update "Yosemite" to "El Capitan".

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

In my php.ini, I added this line :

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

When I launch this command line :

php -i | grep 'mcrypt'

I have :

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

Command 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

I installed mcrypt with :

brew install php56-mcrypt

I did that :

brew link php56-mcrypt

why mcrypt it not working ?

Thank you in advance.
Sincerely Philippe.

like image 407
Pilipe Avatar asked Nov 10 '22 04:11

Pilipe


1 Answers

I was able to resolve this by uninstalling Homebrew, reinstalling Homebrew and then installing the php 5.6 mcrypt package. The advantage of this method over Pilipe's solution is it doesn't require disabling the new System Integrity Protection (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])
like image 62
Brett DeWoody Avatar answered Nov 14 '22 21:11

Brett DeWoody