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. div/span等获取焦点问题(tabindex属性的简单理解)

    1.先看问题 当我们要对一个div/span元素获取焦点的时候,直接对$("#div1").focus()是不能实现效果的,比如下图: 当点击输入框进行输入后,在点击区域弹出选择地 ...

  2. Google Chrome 55 Released – Install on RHEL/CentOS 7/6 and Fedora 25-20

    Google Chrome is a freeware web browser developed by Google Inc. Google Chrome team proudly announce ...

  3. 动态创建DataTable总结

    最简单的: DataTable dt = new DataTable(); dt.Columns.Add("id"); dt.Columns.Add("name" ...

  4. Every student in every school should have the opportunity to learn to code

    “I think everybody in this country should learn how to program a computerbecause it teaches you how ...

  5. Unity3d 引擎原理详细介绍、Unity3D引擎架构设计

    体系结构 为了更好地理解游戏的软件架构和对象模型,它获得更好的外观仅有一名Unity3D的游戏引擎和编辑器是非常有用的,它的主要原则. Unity3D 引擎 Unity3D的是一个屡获殊荣的工具,用于 ...

  6. mysql一对多关联查询的时候筛选条件

    mysql实现users 表和 logoin_log表是一对多, 现在是把user的信息找出来 关联上一些 logoin_log表的数据, 因为a表是多的一方,要多他的数据进行一些条件匹配,这个sql ...

  7. C 【block类型全方位详解】

    ------------------------------------------- block变量的概念 #import <Foundation/Foundation.h> int m ...

  8. 20141009---Visual Studio 2012 预定义数据类型

    预定义数据类型 一.值类型 整型:(整数) 有符号整型和无符号整形,区别是有符号的有负数无符号的都是正数, 2x+1 常用int 有符号:              带有正负数,范围为按所写依次增大 ...

  9. 分享9款用HTML5/CSS3制作的动物人物动画

    1.纯CSS3绘制可爱的蚱蜢 还有眨眼动画 今天我们要分享一个利用纯CSS3绘制的蚱蜢动画,非常可爱. 在线演示 源码下载 2.HTML5 Canvas头发飘逸动画 很酷的HTML5动画 HTML5 ...

  10. JS函数式编程【译】2.1 函数式编程语言