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. 转:基于TLS1.3的微信安全通信协议mmtls介绍

    转自: https://mp.weixin.qq.com/s?__biz=MzAwNDY1ODY2OQ==&mid=2649286266&idx=1&sn=f5d049033e ...

  2. Android锁屏软件

    需求描述:锁屏软件就是点击应用然后直接锁屏,不会弹出任何界面 设计思路:应用启动以后通过getSystemService获取系统的服务,调用安卓系统的DevicePolicyManager和Compo ...

  3. 201509020-js

    JS 关于(function( window, undefined ) {})(window)写法的理解   JS 关于(function( window, undefined ) {})(windo ...

  4. Jquery 格式化时间

    我们常常会通过datetime得到时间,但是网页前台往往会显示不同的时间 如:2013-12-15 2013年12月23日 2013 12 15 等多种显示效果,这就需要我们把时间格式化一下. 下面是 ...

  5. Linq 数据库操作(增删改查)

    Linq数据库增删改查 Linq是一种查询语言,集成包含在formwork中,包含在C#语言中,它的作用是降低查询的门槛,提高开发效率,是我们必须掌握的技术之一,下面是我自己对linq数据库操作的方法 ...

  6. JS正则表达式简单总结

    正则表达式定义 JavaScript中的正则表达式用RegExp 对象表示,可以使用RegExp ()构造函数来创建RegExp对象,不过RegExp 对象更多的是通过一种特殊的直接量愈发来创建. 例 ...

  7. MySQL之连接数据库的两种方法

    方法一: package DB; import java.sql.Connection; import java.sql.DriverManager; public class Conn { // 定 ...

  8. AJAX之JSON

    AJAX=Asynchronous JavaScript and XML(异步的JavaScript 和XML). AJAX不是新的编程语言,而是一种是用现代标准的新方法,用于创建快速动态网页的技术. ...

  9. .Net 接连 Oracle 数据库(Winform)

    之前一直是使用Asp.Net 连接 Oracle 10g,最近想写个小程序,所以选择了 Winform.折腾半天后,才发现 Winform 与 Asp.Net 连接 Oracle 是有些许区别的. 区 ...

  10. SAP存货账龄分析之库存获取

    前段时间上面要求做一个历史库存账龄分析,取历史数据的时候一直纠结于用mchb/mchbh/mska/mskah等实时和历史库存表,然而试来试去还是不能成功,于是决定DEBUG下MB5B的源代码,测试了 ...