mcrypt is a file encryption method using secure techniques to exchange data. It is required for some web apps for example Magento, the shopping cart software or a php framework likeLaravel. This tutorial has been tested in OSX 10.10 Yosemite.

This guide is really for users with the version of PHP that shipped with OSX Yosemite which is version 5.5.14. Other downloadable AMP stacks already have mcrypt baked in.

Command Line Tools

First up you will need the OSX 10.10 version of Command Line Tools which you can download via the Apple available updates in the App store.

Run in the Terminal

xcode-select --install

Getting it on in OS X Yosemite 10.10

This tutorial works mostly in the Terminal, launch it from /Applications/Utilities, change directory (cd) to the home account and make a directory that you will work in, call it mcrypt

cd ~ ; mkdir mcrypt ; cd mcrypt

Get libmcrypt 2.5.8 from Sourceforge, this is direct download link.

Get the php code in a tar.gz or .bz2 format- (version 5.5.14 is the one that currently ships with OSX 10.10)

Move both of these files that you downloaded into your working directory – mcrypt in this instance, and go back to Terminal

cd ~/mcrypt

Expand both files via the command line or just double click them in the Finder:

tar -zxvf libmcrypt-2.5.8.tar.gz
tar -zxvf php-5.5.9.tar.gz

Remove the compressed archives

rm *.gz

Any errors on the command line including C++ and g++ mostly are due to the command line tools missing.

Configuring libmcrypt

Change directory into libmcrypt
 
cd libmcrypt-2.5.8
 
Libmcrypt needs to be configured, enter
./configure
make
sudo make install

With the libmcrypt configured and libraries now installed, time for to make the mcrypt extension.

Install Autoconf

Install autoconf – some more Terminal heavy lifting:

cd ~/mcrypt
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

Compile mcrypt php Extension

cd ../php-5.5.9/ext/mcrypt/
/usr/bin/phpize

Output should be similar to:

Configuring for:
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 220121212

./configure
make
sudo make install

The result of this should be similar to:

Installing shared extensions:  /usr/lib/php/extensions/no-debug-non-zts-20121212/

Enabling mcrypt.so  php Extension

Open /etc/php.ini and add the line below at the end

extension=mcrypt.so

If there is no php.ini file,  then you need to make one from php.ini.default in the same location like so:

sudo cp /etc/php.ini.default /etc/php.ini

And allow write capability

sudo chmod u+w  /etc/php.ini

Then add the line as above in your favourite text editor:

sudo nano /etc/php.ini

or

sudo vi /etc/php.ini

and add in the line:

extension=mcrypt.so

Restart Apache

sudo apachectl restart

That’s it, create a php page with the function phpinfo();  to see if it loaded correctly.

If it didn’t load you may need to declare the extensions directory in /etc/php.ini

extension_dir = "/usr/lib/php/extensions/no-debug-non-zts-20100525/"

Hopefully it wasn’t too much of a nightmare…

tales-from-the-mcrypt-yosemite-osx-php

转自:http://coolestguidesontheplanet.com/install-mcrypt-php-mac-osx-10-10-yosemite-development-server/

Install mcrypt for php on Mac OSX 10.10 Yosemite for a Development Server的更多相关文章

  1. 在OSX狮子(Lion)上安装MYSQL(Install MySQL on Mac OSX)

    这篇文章简述了在Mac OSX狮子(Lion)上安装MySQL Community Server最新版本v10.6.7的过程. MySQL是最流行的开源数据库管理系统.首先,从MySQL的下载页面上下 ...

  2. Mac OSX 下配置 LNMP开发环境

    不久前负责了一个项目需要配置PHP7的开发环境,因为之前所有的项目用的是PHP5的,所以研究了这些东西,但是很遗憾,电脑出了问题,不得已重装了系统,然后你懂得...什么都没有了,要重新来过.. 虽然本 ...

  3. Mac OSX操作系统安装和配置Zend Server 6教程(1)

    作为web开发人员,应该熟悉掌握各种系统下安装和配置web服务器与站点的技术. 随着越来越多的开发人员选择Zend Server服务器,慧都推出了在Mac OSX系统安装和配置Zend Server ...

  4. XE6移动开发环境搭建之IOS篇(7):在Mac OSX 10.8中安装Xcode4.6.3(有图有真相)

    网上能找到的关于Delphi XE系列的移动开发环境的相关文章甚少,本文尽量以详细的图文内容.傻瓜式的表达来告诉你想要的答案. 原创作品,请尊重作者劳动成果,转载请注明出处!!! 在安装Xcode前, ...

  5. 虚拟机VMware 9安装苹果MAC OSX 10.8图文教程

    前些天虚拟机VMware Workstation 9出来,相信大家都已经熟悉VM9了,至于MAC OSX 10.8系统,那也是出来一段时间了,本篇文章就是来讲解VMware Workstation 9 ...

  6. 深度学习框架-caffe安装-环境[Mac OSX 10.12]

    深度学习框架-caffe安装 [Mac OSX 10.12] [参考资源] 1.英文原文:(使用GPU) [http://hoondy.com/2015/04/03/how-to-install-ca ...

  7. 深度学习框架-caffe安装-Mac OSX 10.12

    p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px ".PingFang SC"; color: #454545 } p.p2 ...

  8. Mac OSX Yosemite 10.10 brew 错误:mktemp: mkdtemp failed on /tmp/git-LIPo: No such file or directory

    这个问题困扰了我非常久非常久.使得我不得不花一点时间来说一下解决方法. 事情是这种:前两天兴高採烈的更新了一下宝贝mac到10.10. 一切看起来都那么美好,可是. .当我又一次安装magento的时 ...

  9. Webstorm 10 for mac osx 注册机,序列号,kegen

    小菜最近get到mac体验机会,早就耳闻mac非常适合做开发,于是迫不及待的安装各种开发工具,不知不觉,轮到前端开发神器webstorm了,看了一下官网的价格,心拔凉拔凉的. 果断搜索注册机,搜到的结 ...

随机推荐

  1. 把Flume的Source设置为 Spooling directory source

    把Flume的Source设置为 Spooling directory source,在设定的目录下放置需要读取的文件,一些文件在读取过程中会报错. 文件格式和报错如下: 实验一 读取汉子和“:&qu ...

  2. 每天一个Linux命令(1):ls命令

    转自http://www.cnblogs.com/peida/archive/2012/12/05/2803591.html ls命令是Linux下最常用的命令.ls命令就是list的缩写,缺省下ls ...

  3. hdu 4598 差分约束

    思路:首先就是判断是否有奇环,若存在奇环,则输出No. 然后用差分约束找是否符合条件. 对于e(i,j)属于E,并且假设顶点v[i]为正数,那么v[i]-v[j]>=T--->v[j]-v ...

  4. Mac OSX系统搭建React natvie for android 开发环境

    1.下载node.js  https://nodejs.org/en/ 下载OSX版本 V5.6  2.安装android SDK  JDK  3.安装react-native-cli 打开命令行,输 ...

  5. Android Studio使用OpenCV后,使APP不安装OpenCV Manager即可运行

    转载自http://www.cnblogs.com/tail/p/4618790.html 采用静态初始化的方法,可以戳下边的链接查看官方的文档介绍 http://docs.opencv.org/do ...

  6. 在调用“Fill”前,SelectCommand 属性尚未初始化

    在调用“Fill”前,SelectCommand 属性尚未初始化 是因为少写了一行代码: private readonly string strConnection = System.Configur ...

  7. UINavigationController基本使用

    写了很长的NavigationController介绍,结果被cnblog吞了,没存档,算了,简单粗暴,直接上如何使用. 1.创建3个Controller,继承自UIViewController 在A ...

  8. 深刻理解C#中资源释放

    今天我的一个朋友看到我写的那篇<C#中用AJAX验证用户登录>时,给我指出了点小毛病.就是在用户登录时,如果用户登录失败,在下面这段代码中,都会new出来一个User对象,如果连续登录失败 ...

  9. UI2_UITextField

    // // ViewController.h // UI2_UITextField // // Created by zhangxueming on 15/7/2. // Copyright (c) ...

  10. 第一次使用easyUI

    一.项目结构图 二.在WebContent下新建resource文件夹,在resource底下创建easyui.将easyUI包放入其中. 三.在springMVC-servlet.xml写入资源路径 ...