0

Im trying to run a application on a local dev. enviorment on OS X Yosemite, but it fails due to mcrypt no being enabled.

I started with this guide: https://coolestguidesontheplanet.com/install-mcrypt-php-mac-osx-10-10-yosemite-development-server/

AndI have gone trough every guide i can find.

In my php.ini file I have added the extensions:

; 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

If use command:

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

Not sure what to do now.

Xeptor
  • 467
  • 5
  • 18
  • It is best not to use mcrypt, it has been abandonware for nearly a decade now. It has therefore been deprecated and will be removed from the core and into PECL in PHP 7.2. It does not support standard PKCS#7 (née PKCS#5) padding, only non-standard null padding that can't even be used with binary data. mcrypt has many outstanding bugs dating back to 2003. Instead consider using [defuse](https://github.com/defuse/php-encryption) or [RNCryptor](https://github.com/RNCryptor), they provide a complete solution, are being maintained and is correct. – zaph Jan 30 '17 at 23:28

2 Answers2

0

It's easy if you can use Homebrew. Run the following command from your Terminal.

brew install autoconf
brew install mcrypt

Restart Apache

sudo apachectl restart

See this answer for other available methods.

Community
  • 1
  • 1
Khorshed Alam
  • 2,667
  • 22
  • 31
0

If you installed mcrypt using homebrew and the module is still not showing in your phpinfo(), you can try the following which works for me (OS X Sierra):

Edit your php.ini (you can use vi or nano instead of atom)

sudo atom /etc/php.ini

Add the following line at the end of your php.ini (your encrypt version maybe different)

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

Restart apache

sudo apachectl restart