以前安装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.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.

这是因为没有安装mcrypt

curl -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.ini

extension=mcrypt.so
sudo apachectl restart

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

在装mcrypt插件时报错,提示:mcrypt fatal error: 'php.h' file not found

按照下面的方法解决了

解决办法:

sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10..sdk/usr/include /usr/include

出自

http://blog.csdn.net/xfnjlove/article/details/18415441

这个问题是遇到多次了,不想再被坑了,

首先使mcrypt软件能够运行,然后安装php扩展模块,并在php.ini配置。

这里注意的是mcrypt软件依赖libmcrypt和mhash两个库,所以安装配置顺序从右至左

下载安装mcrypt

1.先去http://www.sourceforge.net下载Libmcrypt,mhash,mcrypt安装包 ,下面是我找到的链接

Libmcrypt(libmcrypt-2.5.8.tar.gz ):

http://sourceforge.net/project/showfiles.php?group_id=87941&package_id=91774&release_id=487459

mcrypt(mcrypt-2.6.8.tar.gz ):

http://sourceforge.net/project/showfiles.php?group_id=87941&package_id=91948&release_id=642101

mhash(mhash-0.9.9.9.tar.gz ):
http://sourceforge.net/project/showfiles.php?group_id=4286&package_id=4300&release_id=645636

2 .先安装Libmcrypt

#tar -zxvf libmcrypt-2.5.8.tar.gz

#cd libmcrypt-2.5.8

#./configure

#make

#make install

说明:libmcript默认安装在/usr/local

3.安装mhash

#tar -zxvf mhash-0.9.9.9.tar.gz

#cd mhash-0.9.9.9

#./configure

#make

#make install

4.安装mcrypt

#tar -zxvf mcrypt-2.6.8.tar.gz

#cd mcrypt-2.6.8

#LD_LIBRARY_PATH=/usr/local/lib/ ./configure -with-libmcrypt-prefix=/usr/local

#make

#make install

说明:由于在配置Mcrypt时,会找不到libmcrypt的链接库,导致无法编译,因为Libmcrypt的链接库在/usr/local/文件夹下。因些在配置mcrypt时要加入LD_LIBRARY_PATH=/usr/local导入键接库,

mac上有时会在make时有错误:rfc2440.c:26:20: error: malloc.h: No such file or directory,修改 rfc2440.c:#include <malloc.h>为#include <sys/malloc.h>, 重新make/make install即可,如在MAC10.9系统上有问题mcrypt fatal error: 'php.h' file not found,后面有详述

5.生成mcypt.so文件

    • 下载并解压PHP源码文件php-5.3.4.tar.gz(一定是和系统的php的版本号一致)。Mac OS X 10.6.3中预装的PHP版本是5.3.4,所以需要下载这个版本。
    • 在终端执行如下命令:
      tar zxvf php-5.3.4.tar.gz
      cd php-5.3.4/ext/mcrypt
      phpize(如果./configure不能执行 先下载autoconf.tar.gz解压 在autoconf文件夹目录下执行./configure 然后make && make install  安装autoconf后就能在php文件夹下使用./configure配置php了 ,如这个装不上,后面还有详述)
      ./configure
      make
      sudo cp modules/mcrypt.so /usr/lib/php/extensions/no-debug-non-zts-20090626/
    • 打开php.ini
      sudo vi /etc/php.ini

      在usr/etc/php.ini,中加入如下代码,并保存后退出,然后重启Apache(如没有复制php.ini.default,有时要修改写权限:chmod  777 php.ini )

      extension=/usr/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so
      到这就结束了。
       

      注意:mac系统升级到10.9(mavericks)时安装php扩展问题解决

      在装mcrypt插件时报错,提示:mcrypt fatal error: 'php.h' file not found,

      然后又仔细操作了一次在输完phpize回车时就已经开始出错了,出错信息如下:

      grep: /usr/include/php/main/php.h: No such file or directory

      grep: /usr/include/php/Zend/zend_modules.h: No such file or directory

      grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory

      Configuring for:

      PHP Api Version:

      Zend Module Api No:

      Zend Extension Api No:

      解决办法:

      sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include /usr/include

       
      如autoconf安装不上,参考:
      安装这4个:
       
      1.curl -O http://mirrors.kernel.org/gnu/m4/m4-1.4.13.tar.gz
      tar -xzvf m4-1.4.13.tar.gz
      cd m4-1.4.13
      ./configure --prefix=/usr/local
      make
      sudo make install
      cd ..
      2.curl -O http://mirrors.kernel.org/gnu/autoconf/autoconf-2.65.tar.gz
      tar -xzvf autoconf-2.65.tar.gz
      cd autoconf-2.65
      ./configure --prefix=/usr/local # ironic, isn't it?
      make
      sudo make install
      cd ..
      # here you might want to restart your terminal session, to ensure the new autoconf is picked up and used in the rest of the script

      3.curl -O http://mirrors.kernel.org/gnu/automake/automake-1.11.tar.gz
      tar xzvf automake-1.11.tar.gz
      cd automake-1.11
      ./configure --prefix=/usr/local
      make
      sudo make install
      cd ..
      4.curl -O http://mirrors.kernel.org/gnu/libtool/libtool-2.2.6b.tar.gz
      tar xzvf libtool-2.2.6b.tar.gz
      cd libtool-2.2.6b
      ./configure --prefix=/usr/local
      make
      sudo make install

<亲测好使>mac os 安装mcrypt扩展的更多相关文章

  1. Mac OS安装php-redis扩展

    下载php-redis(用于php5.x的版本),地址:https://nodeload.github.com/nicolasff/phpredis/zip/master. 如果是php7.2,选择p ...

  2. mac 下安装mcrypt 扩展

    参考: http://coolestguidesontheplanet.com/how-to-install-mcrypt-for-php-on-mac-osx-lion-10-7-developme ...

  3. Android蓝牙自动配对Demo,亲测好使!!!

    蓝牙自动配对,即搜索到其它蓝牙设备之后直接进行配对,不需要弹出配对确认框或者密钥输入框. 转载请注明出处http://blog.csdn.net/qq_25827845/article/details ...

  4. Android蓝牙自动配对Demo,亲测好使!!!(转)

    蓝牙自动配对,即搜索到其它蓝牙设备之后直接进行配对,不需要弹出配对确认框或者密钥输入框. 转载请注明出处http://blog.csdn.net/qq_25827845/article/details ...

  5. CentOS下php安装mcrypt扩展

    CentOS下php安装mcrypt扩展 Posted on 2012-09-12 15:27 C'est la vie 阅读(48294) 评论(3) 编辑 收藏 (以下步骤均为本人实际操作,可能与 ...

  6. Mac os安装DVWA环境教程

    Mac os安装DVWA环境教程 1.尽管Mac自带Apache和php 事实上Mac和WIN都用XAMPP一键化安装比较方便 2.解压DVWA-master 改名为dvwa移动到XAMPP的目录 3 ...

  7. 转载--php 7.2 安装 mcrypt 扩展

    在 php 官网下载 mcrypt 包,php 扩展官网 # wget http://pecl.php.net/get/mcrypt-1.0.1.tgz # tar xf mcrypt-1.0.1.t ...

  8. mac OS 安装配置Nginx服务器

    系统环境 安装工具 Homebrew软件包管理器 :<mac OS 安装 Homebrew软件包管理器>https://blog.csdn.net/weixin_41791279/arti ...

  9. mac php7.2 安装mcrypt扩展

    安装: brew install libmcrypt 下载mcrypt扩展源码 http://pecl.php.net/package/mcrypt 解压后 进入目录: phpize ./config ...

随机推荐

  1. ps怎么给文字描边

    在设计的时候,单一的文字,往往对人没有多少的吸引力,这就需要我们在文字上加一些文字特效,比如说外发光,描边,投影,等等.在这里我们详细的介绍一下文字的输入,和文字描边的怎么增加,删除的经验.(这些方法 ...

  2. POJ 1308 Is It A Tree? (并查集)

    Is It A Tree? Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 24237   Accepted: 8311 De ...

  3. 使用aop记录数据库操作的执行时间

    在项目中,我们往往需要记录数据库操作的时间,根据操作时间的不同,分别记录不同等级的日志. 首先我们可以写一个类实现MethodInterceptor接口: import org.aopalliance ...

  4. 【.NET基础】--委托、事件、线程(2)

    本文介绍event的使用以及原理,本文接上一篇文章的Demo继续[下载上一篇Demo] 上一篇我们在类(dg_SayHi.cs)里面定义代理了4个Delegate,然后在Button的后台事件中 新建 ...

  5. c#中文件上传(1)

    * * ;//3M picPath = Server.MapPath("........."); HttpFileCollection postfile = Context.Req ...

  6. Eclipse中调试技巧

    1.打印输出 System.outprintln(“执行了此程序"); 2.运用Log方法: 示例 Log.d("myDubug",  "myFirstDebu ...

  7. SQLServer Ansi_Padding的用法

    关于Ansi_Padding的用法 1.当设置为ON时,不剪裁字符值中插入到varchar列的尾随空格和二进制值中插入到varbinary列的尾随零.不将值按列的长度进行填充. 2.当设置为OFF时, ...

  8. CentOS7 固定ip

    1. 进入/etc/ network-scripts/ 下ifcfg-eno16777736(文件名可能不一样,单前缀一般是ifcfg-eno) 2. vi打开 编辑  修改bootproro=&qu ...

  9. Apache windows多线程设置

    # WinNT MPM # ThreadsPerChild: constant number of worker threads in the server process # MaxRequests ...

  10. iOS 自定义view里实现控制器的跳转

    1.view里实现控制器的modal 拿到主窗口的根控制器,用根控制器进行modal需要的modal的控制器 场景:点击自定义view里的按钮实现控制器的modal UIViewController ...