Skip to content

Instantly share code, notes, and snippets.

@devarda
Forked from idleberg/Install-Mcrypt.md
Last active March 2, 2020 16:56
Show Gist options
  • Save devarda/c298ede9142ef86431dbbe08757890a9 to your computer and use it in GitHub Desktop.
Save devarda/c298ede9142ef86431dbbe08757890a9 to your computer and use it in GitHub Desktop.
Mac OSX PHP Extensions 10.15 Catalina
# Will show you any php packages you've got. make not of that!
brew list | grep php
# Will uninstall any php packages you may have
brew list | grep php | while read x; do brew uninstall --force $x; done
# You may need to run this too
rm -rf /usr/local/Cellar/php
# Clean up Launch Agents
rm ~/Library/LaunchAgents/homebrew.mxcl.php*
sudo rm /Library/LaunchDaemons/homebrew.mxcl.php*
brew untap homebrew/php
brew cleanup
brew update
brew doctor # just to make sure you're all clean
ps ax | grep php
# if some PHP daemons are still runing, reboot.

Install latest version of PHP: https://medium.com/@romaninsh/install-php-7-2-xdebug-on-macos-high-sierra-with-homebrew-july-2018-d7968fe7e8b8

brew install php

note, that there are no longer options --with-httpd and

--with-thread-safety.

This installs the following essential files: /usr/local/opt/php/lib/httpd/modules/libphp7.so — your apache module. /usr/local/bin/php — your command line PHP. /usr/local/sbin/php-fpm — your PHP-FPM binary. I also recommend installing composer from homebrew:

brew install composer

(if this helps)

Setup php-mcrypt on macOS (and versions of Mac OS X)

These steps should have been mentioned in the prerequisites of the Laravel Installation Guide, since I'm surely not the only person trying to get Laravel running on macOS.

Install

Install Mcrypt using Homebrew and PECL (comes with PHP)

# PHP 7.3
$ brew install mcrypt
$ pecl install mcrypt-1.0.3

Find your php.ini:

$ php -i | grep "Loaded Configuration File"
Loaded Configuration File => /usr/local/etc/php/7.3/php.ini

Add this line to your php.ini:

extension=/usr/local/Cellar/php/7.3.x/pecl/20180731/mcrypt.so

Historic Answer

Install Mcrypt using Homebrew

# PHP 7
$ brew install php70-mcrypt

# PHP 5
$ brew install php56-mcrypt --without-homebrew-php

Add this line to /private/etc/php.ini:

# PHP 7
extension="/usr/local/Cellar/php70-mcrypt/7.0.x/mcrypt.so"

# PHP 5
extension="/usr/local/Cellar/php56-mcrypt/5.6.x/mcrypt.so"

You are ready to go!

Upgrade

Upgrade Mcrypt using Homebrew

$ brew reinstall -fs php71-mcrypt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment