Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Hi, currently trying to setup a project using PHP 7.4 on macOS Big Sur. The project requires mcrypt library.
So I followed all the instructions and set up PHP 7.4.27:

brew install shivammathur/php/php@7.4
echo 'export PATH="/usr/local/opt/php@7.4/bin:$PATH"' >> /Users/test/.bash_profile
echo 'export PATH="/usr/local/opt/php@7.4/sbin:$PATH"' >> /Users/test/.bash_profile
export LDFLAGS="-L/usr/local/opt/php@7.4/lib"
export CPPFLAGS="-I/usr/local/opt/php@7.4/include"
brew link --overwrite --force shivammathur/php/php@7.4

Thereafter installed mcrypt:

brew install mcrypt
/usr/local/opt/php\@7.4/bin/pecl install mcrypt-1.0.4
pecl config-get ext_dir | pbcopy
mkdir -p /usr/local/lib/php/pecl/20190902
/usr/local/opt/php\@7.4/bin/pecl install mcrypt-1.0.4

Created conf.d/mcrypt.ini:

[mcrypt]
extension="/usr/local/opt/php@7.4/lib/php/20190902/mcrypt.so"

Restarted Apache, however phpinfo() shows all info from php.ini correctly except missing mcrypt module.
At the same time, CLI shows different result:

$ php -i | grep mcrypt
/usr/local/etc/php/7.4/conf.d/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
$ php -m | grep mcrypt
mcrypt

Checked CLI ini:

$ php --ini
Configuration File (php.ini) Path: /usr/local/etc/php/7.4
Loaded Configuration File:         /usr/local/etc/php/7.4/php.ini
Scan for additional .ini files in: /usr/local/etc/php/7.4/conf.d
Additional .ini files parsed:      /usr/local/etc/php/7.4/conf.d/ext-opcache.ini,
/usr/local/etc/php/7.4/conf.d/mcrypt.ini

It is the same as in phpinfo():
image

I'm stuck 😢 Any help would be appreciated.
Could there be any issue due to built-in extensions and use pkg config?

UPD: extension_dir = "/usr/local/Cellar/php@7.4/7.4.27/pecl/20190902" Changing the extension_dir didn't help as well.

You must be logged in to vote

Unfortunately, I don't.

Also, I've checked CLI with explicit INI file set:

$ php -c /usr/local/etc/php/7.4/php.ini -i | grep mcrypt
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

But it still doesn't appear on phpinfo() webpage.

Replies: 2 comments · 8 replies

Comment options

As per your output of php -i | grep mcrypt, It seems to be installed correctly. In phpinfo() you should have a mcrypt heading.

image

You must be logged in to vote
4 replies
@ikurnosov
Comment options

Btw, which version of PHP do you use?

@shivammathur
Comment options

I used the same shivammathur/php/php@7.4, but could not reproduce the issue.

@ikurnosov
Comment options

Is there any reasons for phpinfo() to ignore modules? Like apache caching modules set or whatever..
Do you use Apache or anything else?
How did you install mcrypt module?

@shivammathur
Comment options

I used Apache using brew package httpd.

Comment options

Unfortunately, I don't.
image

Also, I've checked CLI with explicit INI file set:

$ php -c /usr/local/etc/php/7.4/php.ini -i | grep mcrypt
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

But it still doesn't appear on phpinfo() webpage.

You must be logged in to vote
4 replies
@shivammathur
Comment options

Did you restart php-fpm and httpd after installing mcrypt using pecl.
If not, please do this and check phpinfo() again

brew services restart php@7.4
brew services restart httpd
@ikurnosov
Comment options

Yes, many times. I'm using built-in apache, so I did it with sudo apachectl -k restart, also tried sudo apachectl -k graceful.
Even rebooted my machine several times.

@shivammathur
Comment options

Try using the brew httpd instead of system one.

@ikurnosov
Comment options

Thanks a lot! Brew's httpd fixed the issue, now I can use mcrypt.
image

So, my guess is there is kind of caching modules within built-in apache.

Answer selected by ikurnosov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.