0

I'm trying to run Laravel's repository and it throws this error:

Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128'

I've googled almost every link and couldn't solve it. So as I realize I need to install mcrypt extension.

So what I've tried is:

  1. brew intsall php71-mcrypt
  2. brew install mcrypt
  3. I've also tried to add extenstion=mcrypt.so in php.ini
  4. I tried to reboot nginx without success (nginx -s stop, nginx)

brew search mcyrpt shows that I got them installed

php -i | grep mcrypt shows:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php71/7.1.4_16/lib/php/extensions/no-debug-non-zts-20160303/mailparse.so' - dlopen(/usr/local/Cellar/php71/7.1.4_16/lib/php/extensions/no-debug-non-zts-20160303/mailparse.so, 9): image not found in Unknown on line 0 Additional .ini files parsed => /usr/local/etc/php/7.1/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.* mcrypt mcrypt support => enabled mcrypt_filter support => enabled mcrypt.algorithms_dir => no value => no value mcrypt.modes_dir => no value => no value

phpinfo() though shows only:

Additional .ini files parsed: /usr/local/etc/php/7.1/conf.d/ext-mcrypt.ini

Also I remember trying to install autoconf and some other things

I guess mcrypt works for php-cli, but not on web version

My php version is 7.1, nginx 1.12.0, mac os El Captain

Victor
  • 149
  • 1
  • 7

2 Answers2

2

Probably the php-fpm - the module used to load php in nginx is using different php.ini file and you have to enable mcrypt there.

To find which php.ini file uses nginx, create test.php file with:

<?php

phpinfo();

run it and search for php.ini in the response. You should find the location of the file.

  • phpinfo() will indeed show whether mcrypt is installed, and where the .ini file should go. The warning quoted the library mailparse.so, so perhaps it would also help to `brew install mailparse. – Cedric Knight Aug 21 '17 at 00:46
-1

I think you restarted nginx with brew, but it's not effected. You need to restart nginx with

sudo nginx -s reload

or you can restart your PC and check. Hope can help.

  • Thanks for answering this, but I think a reload or reboot is rather generic and according to the question has already been tried. It looks like the correct php extensions have not been installed. – Cedric Knight Aug 21 '17 at 00:35