热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

InstallmcryptforphponMacOSX10.10Yose

mcrypt is a file encryption method using secure techniques to exchange data. It is required f

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.

osx-yosemite-mcrypt

 

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/"


php-extension-directory-lion-mcrypt

 

Hopefully it wasn’t too much of a nightmare…

 

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

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




推荐阅读
  • 本文介绍了在使用Laravel和sqlsrv连接到SQL Server 2016时,如何在插入查询中使用输出子句,并返回所需的值。同时讨论了使用CreatedOn字段返回最近创建的行的解决方法以及使用Eloquent模型创建后,值正确插入数据库但没有返回uniqueidentifier字段的问题。最后给出了一个示例代码。 ... [详细]
  • 本文提供了成为成功软件工程师的7条建议,包括不要低估自己、公司需要你、投资自己等。通过学习新技术、提升编码技能,软件工程师可以获得更好的职业机会和更高的薪水,同时也增强自信。投资自己是取得成功的关键。 ... [详细]
  • 依赖注入_php 依赖注入容器
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了php依赖注入容器相关的知识,希望对你有一定的参考价值。原文: http://blog.csdn.net/r ... [详细]
  • Scarp框架需求获取网页的url下载网页内容(Downloader下载器)定位元素位置,获取特定的信息(Spiders蜘蛛)存储信息(ItemPipeline,一条一条从管里走) ... [详细]
  • 使用雄辩的模型,您只需通过调用即可更新数据$model-update($data);但不幸的是,这并没有更新关系.如果您还想更新关系,则需要手动分配每个值并调用push()然后: ... [详细]
  • 本文介绍了闭包的定义和运转机制,重点解释了闭包如何能够接触外部函数的作用域中的变量。通过词法作用域的查找规则,闭包可以访问外部函数的作用域。同时还提到了闭包的作用和影响。 ... [详细]
  • 在Android开发中,使用Picasso库可以实现对网络图片的等比例缩放。本文介绍了使用Picasso库进行图片缩放的方法,并提供了具体的代码实现。通过获取图片的宽高,计算目标宽度和高度,并创建新图实现等比例缩放。 ... [详细]
  • 向QTextEdit拖放文件的方法及实现步骤
    本文介绍了在使用QTextEdit时如何实现拖放文件的功能,包括相关的方法和实现步骤。通过重写dragEnterEvent和dropEvent函数,并结合QMimeData和QUrl等类,可以轻松实现向QTextEdit拖放文件的功能。详细的代码实现和说明可以参考本文提供的示例代码。 ... [详细]
  • 本文介绍了RPC框架Thrift的安装环境变量配置与第一个实例,讲解了RPC的概念以及如何解决跨语言、c++客户端、web服务端、远程调用等需求。Thrift开发方便上手快,性能和稳定性也不错,适合初学者学习和使用。 ... [详细]
  • 本文讨论了编写可保护的代码的重要性,包括提高代码的可读性、可调试性和直观性。同时介绍了优化代码的方法,如代码格式化、解释函数和提炼函数等。还提到了一些常见的坏代码味道,如不规范的命名、重复代码、过长的函数和参数列表等。最后,介绍了如何处理数据泥团和进行函数重构,以提高代码质量和可维护性。 ... [详细]
  • 本文介绍了一个React Native新手在尝试将数据发布到服务器时遇到的问题,以及他的React Native代码和服务器端代码。他使用fetch方法将数据发送到服务器,但无法在服务器端读取/获取发布的数据。 ... [详细]
  • 【前端工具】nodejs+npm+vue 安装(windows)
    预备先看看这几个是干嘛的,相互的关系是啥。nodejs是语言,类比到php。npm是个包管理,类比到composer。vue是个框架&# ... [详细]
  • 如何通过swoole加速laravel的问题?
    这篇文章主要介绍了关于如何使用swoole加速laravel,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下再来复习一下吧,导致php慢的各种因素中解析性语言的 ... [详细]
  • laravel 使用腾讯云 COS5全教程
    laravel使用腾讯云COS5全教程一下载首先第一步肯定是用composer把包安装下来,这里是laravel5.8版本的,所以我用的是cos5 ... [详细]
  • InterfaceAsSchematic接口就是大纲接口在开发程序的“骨架”时非常有用。在设计组件时,使用接口进行设计和讨论都是对你的团队有益处的。比如定义一个BillingNot ... [详细]
author-avatar
尚庆湃
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有