Enable MCrypt using MAMP

人走茶凉 提交于 2019-12-24 08:50:45

问题


I'm using MAMP and ive installed a fresh version of Opencart, its telling me i dont have MCrypt enabled, when i go to terminal and type:

php -m | grep mcrypt
output: mcrypt

I can locate the library but it doesn't seem to be enabled.


回答1:


That fact that php -m | grep mcrypt returns mcrypt, means the mcrypt library is INSTALLED and ENABLED.

Although it may just be enabled for CLI.

You can try editing the PHP.ini file and adding the following line under the ; Extensions section:

extension=mcrypt.so

Restart Apache / MAMP after saving php.ini file.

To find the correct php.ini file to edit, run the following command line:

php --info | grep php.ini

(If the line already exists, you may just need to remove the ; thats in front of it.)




回答2:


I had this issue following upgrading to MAMP 5.1 and using PHP 7.1.20...

The issue I found was not that MAMP PHP did not have mcrypt installed, it certainly does come bundled.

The issue was that the MAMP PHP configuration option "Make this version available on the command line" was NOT working and so the version of PHP I was using on the command line [in my case] was the macOS default PHP 7.1.16 without mcrypt (the version included in macOS by default)

Reverting to the old cli php alias meant the correct MAMP version of PHP was used on the command line

Added to .bash_profile

alias php='/Applications/MAMP/bin/php/php7.1.20/bin/php'



回答3:


I have tried so many ways but had no luck. After a lot of trials finally came up with a solution. Go to bin directory inside current active PHP version directory. In my case it is /Applications/MAMP/bin/php/php7.2.8/bin It might be different in your case. Now run the below command with sudo

sudo ./pecl install channel://pecl.php.net/mcrypt-1.0.1

Now You should add extension=mcrypt.so to php.ini Restart MAMP Service and check if it is working.




回答4:


try in console

pecl install mcrypt


来源:https://stackoverflow.com/questions/42504777/enable-mcrypt-using-mamp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!