Anton Bahrencheer
Anton Bahrencheer

Reputation: 41

Enable MCrypt using MAMP

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.

Upvotes: 1

Views: 20153

Answers (5)

Tum
Tum

Reputation: 7575

Using Brew:

  1. Install mcrypt: brew install mcrypt
  2. In Mamp: File -> Edit Template -> PHP (php.ini)-> {PHP version}
  3. Find 'Dynamic Extensions' in the text and add the following below (after the lines starting with ';'):

    extension=mcrypt.so

  4. Save, restart and test (with php -i | grep mcrypt for example)

Upvotes: 1

Alex
Alex

Reputation: 767

try in console

pecl install mcrypt

Upvotes: 2

Shahnawaz Alam
Shahnawaz Alam

Reputation: 86

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.

Upvotes: 4

Flipmedia
Flipmedia

Reputation: 490

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'

Upvotes: 3

Niraj Shah
Niraj Shah

Reputation: 15457

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.)

Upvotes: 6

Related Questions