Skip to content

Instantly share code, notes, and snippets.

@massimoselvi
Forked from teroyks/php-mcrypt-homebrew.md
Created March 8, 2018 09:14
Show Gist options
  • Save massimoselvi/a12d4357ce2df4f3891ad0285961a836 to your computer and use it in GitHub Desktop.
Save massimoselvi/a12d4357ce2df4f3891ad0285961a836 to your computer and use it in GitHub Desktop.
Add PHP mcrypt extension on Mac OS X with Homebrew

You can install the mcrypt PHP extension with homebrew and use it with the standard PHP installation that comes with OS X.

Install mcrypt:

brew install mcrypt

Install the php extension -- this installs the whole php 5.5, but you can still use the system-provided one by default Note: install the version compatible with whatever your OS X PHP version currently is (check with php -v)

brew install homebrew/php/php55-mcrypt

The mcrypt shared library should now be installed in /usr/local/Cellar/php55-mcrypt/5.5.30/mcrypt.so.

The PHP settings file is /private/etc/php.ini. If you don't have said file, copy contents from php.ini.default in the same directory as your php.ini.

Find the Dynamic Extensions section of the php.ini file and add the following line to it:

extension=/usr/local/Cellar/php55-mcrypt/5.5.30/mcrypt.so

After this, you should have mcrypt installed and enabled in PHP (check with php -m -- mcrypt should be listed among the modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment