为 Mac OS X 系统下的 PHP 增加 mCrypt

现在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

发表评论

Fill in your details below or click an icon to log in:

WordPress.com 徽标

You are commenting using your WordPress.com account. Log Out /  更改 )

Google photo

You are commenting using your Google account. Log Out /  更改 )

Twitter picture

You are commenting using your Twitter account. Log Out /  更改 )

Facebook photo

You are commenting using your Facebook account. Log Out /  更改 )

Connecting to %s