Mac OSX 为PHP安装mcrypt扩展
MAC /
2016-08-27 /
阅读: 137
Mac OSX自带的PHP版本不新,而且扩展也不全,于是想着重新编译一个PHP安装,但是有的时候,有些扩展功能并没有安装,例如:这次的mcrypt,只能手动安装,以下是操作步骤:
1、brew安装mcrypt
brew install libmcrypt
2、php安装mcrypt扩展
下载php对应版本的源码
进入源码目录执行
cd ~/Downloads/php-5.5.14/ext/mcrypt phpize ./configure make cd modules sudo cp mcrypt.so /usr/lib/php/extensions/no-debug-non-zts-20121212/
3、打开php.ini
sudo vi /etc/php.ini
添加如下代码:(注意no-debug-non-zts-20121212版本号,如果不清楚可以前往/usr/lib/php/extensions/查看)
extension=/usr/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so
错误处理:
1、phpize出现
Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script.
说明要求安装autoconf
brew install autoconf
2、phpize出现
/usr/local/Library/ENV/4.3/sed: No such file or directory
执行命令
mkdir /usr/local/Library/ENV ln -s /usr/local/Library/Homebrew/shims/super/ /usr/local/Library/ENV/4.3