现在Laravel、Opencart等软件都是需要PHP支持mCrypt了,
可是Mac OS X 默认的PHP版本是不支持mCrypt的,
使用homebrew可以像yum或apt-get那样快速的安装它。
步骤如下:
# 安装 Command Line Tools xcode-select --install # 安装 homebrew ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew doctor brew update # 添加源, 因为默认源没有php55-mcrypt brew tap homebrew/dupes brew tap homebrew/versions brew tap homebrew/homebrew-php # 安装 autoconf brew install autoconf # 安装 mcrypt brew install autoconf mcrypt # 安装 php55-mcrypt 同时会安装最新版本的PHP5.5 brew install php55-mcrypt # 查看安装到哪里了 brew info php55-mcrypt # 现在php55-mcrypt安装好了,但是phpinfo()的时候应该没有mcrypt,还需要修改libphp5.so的路径 # 编辑 /etc/apache2/httpd.conf LoadModule php5_module /usr/local/opt/php55/libexec/apache2/libphp5.so # 现在php.ini使用的是 /usr/local/etc/php/5.5/php.ini 不是默认的 /etc/php.ini.default