以前安装opencart的时候倒是不需要mcrypt 这个库。但是新版本需要了。加上自己的 是mac环境。当时闲麻烦,就一直没装。这次下午就寻思给装上吧! 1.首先你要先安装xcode这个工具。不然没办法编译! xcode这个可以在苹果appstore下载。 2.安装command line tools 打开xcode .->> Preferences 然后点击command line toolsinstall 等下再完成安装就行了 也可以按照这个国外高人写的安装 https://github.com/kennethreitz/osx-gcc-installer 3.安装 Autoconfcd /tmp
curl -O http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz
tar xvfz autoconf-latest.tar.gz
cd autoconf-2.69/
./configure
make
sudo make install
(需要输入你的密码)
autoconf --version 老验证是否安装成功
fyhqytekiMacBook-Pro:tmp fyhqy$ autoconf --version
autoconf (GNU Autoconf) 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+/Autoconf: GNU GPL version 3 or later
, This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by David J. MacKenzie and Akim Demaille.
4. 安装 libmcrypt 先检查机器的php版本。默认10.8安装的php版本是5.3.15.fyhqytekiMacBook-Pro:tmp fyhqy$ php -v
PHP 5.3.15 with Suhosin-Patch (cli) (built: Aug 24 2012 17:45:44)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
下载对应版本的php版本包 5.3.15源码包 可以自己去页面下载。默认的托管在sina的sae上面http://cn2.php.net/distributions/php-5.3.15.tar.gz
这个是5.3.15版本所有下载地址http://php.net/get/php-5.3.15.tar.gz/from/a/mirror
curl -O http://cn2.php.net/distributions/php-5.3.15.tar.gz
tar zxvf php-5.3.15.tar.gz
cd php-5.3.15/ext/mcrypt/
/usr/bin/phpize
./configure
make
sudo make install
编译的时候可能会提示这行configure: error: mcrypt.h not found. Please reinstall libmcrypt.
这是因为没有安装mcryptcurl -O http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure --prefix=/usr/local/Cellar/mcrypt/2.5.8 --mandir=/usr/local/Cellar/mcrypt/2.5.8/shar
make
sudo make install
然后再执行上面步骤! 安装完成之后会提示Installing shared extensions: /usr/lib/php/extensions/no-debug-non-zts-20090626/
然后修改php.ini。把扩展添加进去 php.ini 存在 /etc/php.iniextension=mcrypt.so
sudo apachectl restart
重启下apache。然后打开phpinfo(); 看是不是已经安装上了嗯!