分享

mac lion10.8中安装mcrypt php扩展

 翼网情深 2014-04-24

mac lion10.8中安装mcrypt php扩展

以前安装opencart的时候倒是不需要mcrypt 这个库。但是新版本需要了。加上自己的 是mac环境。当时闲麻烦,就一直没装。这次下午就寻思给装上吧! 1.首先你要先安装xcode这个工具。不然没办法编译! xcode这个可以在苹果appstore下载。 2.安装 command line tools   打开xcode .->> Preferences 然后点击command line tools   install  等下再完成安装就行了 也可以按照这个国外高人写的安装 https://github.com/kennethreitz/osx-gcc-installer 3.安装 Autoconf

cd /tmp
curl -O http://ftp./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./distributions/php-5.3.15.tar.gz

这个是5.3.15版本所有下载地址

http:///get/php-5.3.15.tar.gz/from/a/mirror
curl -O http://cn2./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.

这是因为没有安装mcrypt

curl -O http:///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.ini 

extension=mcrypt.so
sudo apachectl restart

重启下apache。然后打开phpinfo();  看是不是已经安装上了嗯!

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约