Install mcrypt for php on Mac OSX 10.10 Yosemite for a Development Server

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 like Laravel. 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/"

时间: 2024-12-26 18:15:46

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

Mac OSX 10.9.4 mavericks 启用系统Apache、PHP服务

众所周知,Mac OSX已经内置了Apache http server 和 php,只用简单的配置一下就能够使用php环境,做本地测试很不错. 1.启用Apache Http Server(sudo apachectl start) 记住下面的命令: // 打开终端(Terminal)输入: sudo apachectl start // 启动服务 sudo apachectl stop // 关闭服务 sudo apachectl restart // 重启服务 通过上述命令可以对系统自带Ap

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

XE6移动开发环境搭建之IOS篇(7):在Mac OSX 10.8中安装Xcode4.6.3(有图有真相) 2014-08-23 21:37 网上能找到的关于Delphi XE系列的移动开发环境的相关文章甚少,本文尽量以详细的图文内容.傻瓜式的表达来告诉你想要的答案. 在安装Xcode前,我们先了解下Mac下如何卸载U盘!在VM9下,同一时间内,一个物理设备只能由一个系统去独占,无论是物理机还是虚拟机.我们可以了解一下虚拟机加载U盘的规则:    1.在虚拟机中加载U盘时,会自动将U盘从Wind

Mac OSX 10.10 Yosemite编译OpenJDK 9

在Mac OSX 10.10系统上编译了下OpenJDK9,以下仅是个人安装记录,供参考. 编译时间:2015-06-13 系统版本:Mac OS X Yosemite 10.10.4 编译OpenJDK版本:JDK 9 相关软件版本: XCode版本:XCode6-Beat4    Version 6.0 (6A267n) JDK版本:1.8.0_45 软件管理工具:brew Xquartz(X11):2.7.7 参考资料: OpenJDK Home Page OpenJDK官方编译步骤(下载

mac osx 10.9 建立机器学习环境(python3.4)

https://pypi.python.org/pypi/ may be setup these export CFLAGS="-arch i386 -arch x86_64" export FFLAGS="-m32 -m64" export LDFLAGS="-Wall -undefined dynamic_lookup -bundle -arch i386 -arch x86_64" export CC=gcc export CXX=&quo

Mac OSX 10.9.5, PHP5.4 安装 memcached

Mac安装memcached Mac安装memcached 安装环境 Mac OSX 10.9.5 Mavericks PHP5.4 使用 homebrew 安装过程 首先使用通过brew寻找需要安装的相关软件 brew install memcached 结构为 libmemcached  php53-memcached  php55-memcached memcached     php54-memcached   php56-memcached 然后依次安装 brew install me

mac osx 10.10 pip 安装问题

在mac osx 升级到 10.10(Yosemite)以后,用pip以及easy_install 安装python包的时候,如果包需要编译,就会编译失败,错误如下: build/temp.macosx-10.10-x86_64-2.7/greenlet.o -o build/lib.macosx-10.10-x86_64-2.7/greenlet.so ld: file not found: python.exe clang: error: linker command failed with

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

这个问题困扰了我很久很久,使得我不得不花一点时间来说一下解决方法. 事情是这样的:前两天兴高采烈的更新了一下宝贝mac到10.10.一切看起来都那么美好,但是..当我重新安装magento的时候发现需要mcrypt!:之前有装过,但是更新了一下就没有了,好吧,重装!!但是这个时候发现,brew update不能用了!!坑屌丝么!!so重装brew!,好不容易装好了,brew install mcrypt的时候,遇到问题: Already downloaded: /Library/Caches/H

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

小菜最近get到mac体验机会,早就耳闻mac非常适合做开发,于是迫不及待的安装各种开发工具,不知不觉,轮到前端开发神器webstorm了,看了一下官网的价格,心拔凉拔凉的. 果断搜索注册机,搜到的结果不少,20%是版本太旧,80%需要vip才能下载. 目前最新的是10+版本,勉强可以下载的都是8+版本,不太符合心思,而其他号称9+版本带注册机的,或者10+版本带序列号的,vip才能下载,既然不想买正版,却给盗版充值,哪有这样的道理. 如果读者因为这件事而苦恼,恰好又看到这篇文章,那么您的问题至

XE6移动开发环境搭建之IOS篇(4):VMware9里安装Mac OSX 10.8(有图有真相)

XE6移动开发环境搭建之IOS篇(4):VMware9里安装Mac OSX 10.8(有图有真相) 2014-08-18 21:10 网上能找到的关于Delphi XE系列的移动开发环境的相关文章甚少,本文尽量以详细的内容.傻瓜式的表达来告诉你想要的答案. 以下内容比较长,我们努力地图解每一个步骤,没有耐心的观众可以忽略前27步,直接看第28步最终结果.--------------------------------------------------------------- 1.在虚拟机主界