Prabowo Murti
Prabowo Murti

Reputation: 1341

Install mcrypt extension on PHP 7.1.33 (with brew on MacOS Sonoma)

We have an old project using PHP 7.1.3 but

brew info shivammathur/php/[email protected] gives ==> shivammathur/php/[email protected]: stable 7.1.33 (bottled) [keg-only]

So I try to make it works by installing the 7.1 package and setup the extension needed (note: we can not use Docker or other kind of VM, and this is the path we've choosen)

What I tried so far

cd /usr/local/opt/[email protected]/bin
PHPIZE=/usr/local/opt/[email protected]/bin/phpize PHP_CONFIG=/usr/local/opt/[email protected]/bin/php-config ./pecl install mongodb-1.6.0

The mongodb extension is finally installed

$ php71 -m | grep mongo
mongodb

The main issue is that the application uses mcrypt_decrypt function

Call to undefined function app\components\encryption\mcrypt_decrypt()

We have difficulties when forcing the PHP 7.1.33 to use mcrypt extension version 1.0.7

PHPIZE=/usr/local/opt/[email protected]/bin/phpize PHP_CONFIG=/usr/local/opt/[email protected]/bin/php-config ./pecl install --force mcrypt-1.0.7

The error message:

  273 |         php_mcrypt_filter_create
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [mcrypt_filter.lo] Error 1

Any suggestion is appreciated. Thank you.

Edited:

Upvotes: 0

Views: 64

Answers (1)

Prabowo Murti
Prabowo Murti

Reputation: 1341

I realize that this brew tap has everything I need, and I don't need to install the old PHP extension using pecl or compiling from source.

https://github.com/shivammathur/homebrew-extensions

brew tap shivammathur/extensions
brew install shivammathur/extensions/[email protected]

Since I already have the old 7.4 mcrypt extension,

brew unlink [email protected]
brew link [email protected] 

Checking

php71 -m | grep mcrypt
mcrypt

Upvotes: 0

Related Questions