Mcrypt for PHP 7.4 on Catalina

apachehomebrewPHP

First of all, I was born and raised using a PC so I'm kind of new to Mac. I was hoping if someone can help me out. I'm using Catalina and trying to get the PHP extension mcrypt installed. I've been trying to use homebrew and I'm seriously stuck. I've researched this like crazy and all the forums are years old or using Ubuntu. I realize that mcrypt is deprecated but Laravel requires it so here I am.

I installed PHP 7.4 using homebrew. I had to add a couple of path lines to my ~/.zshrc file because the terminal kept saying PHP was 7.3. I run brew install mcrypt and it downloads and "Pours" into /usr/local/Cellar/mcrypt/2.6.8. I try to update my 7.4 php.ini file with a dynamic library path. So I try adding extension=/usr/local/Cellar/php/7.4.5_2/pecl/20190902/mcrypt.so to the ini for PHP. I restart apache and I get:

Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php/7.4.5_2/pecl/20190902/mcrypt.so' (tried: /usr/local/Cellar/php/7.4.5_2/pecl/20190902/mcrypt.so (dlopen(/usr/local/Cellar/php/7.4.5_2/pecl/20190902/mcrypt.so, 9): image not found), /usr/local/lib/php/pecl/20190902//usr/local/Cellar/php/7.4.5_2/pecl/20190902/mcrypt.so.so (dlopen(/usr/local/lib/php/pecl/20190902//usr/local/Cellar/php/7.4.5_2/pecl/20190902/mcrypt.so.so, 9): image not found)) in Unknown on line 0

I have no idea where to go from here. Anyone have a tip?

Thanks!

Best Answer

Don't know if this is the right way but I got it to work: https://stackoverflow.com/questions/54028143/mcrypt-php-extension-required-on-mac-os-x-mojave

The answer on there was to pretty much remove any link for mcrypt and then re-link it. I had issues with the autoconf which required some file permissions tweaking (sudo wasn't working). That answer was here. https://stackoverflow.com/questions/16844826/error-when-trying-to-brew-link-autoconf

This was such a nightmare but that worked for me.