Mac php 扩展目录(mcrypt)

Mac 自带php 环境,但是往往我们需要的php扩展不全。所以会遇到需要按照php扩展的情况 如

mcrypt 、mongodb

我在安装这些扩展的时候就遇到,找不到PHP扩展文件夹的时候 。

原因是Mac自带PHP的扩展都是已经编译好了的,所以严格上来说不是扩展。那么我们需要添加扩展的话就需要先安装扩展,然后再配置好才能用。

注:所以php.ini中的;extension_dir = “./”  配置项是注释状态。

下面是一个实例:

如安装mcrypt 扩展。

先查看本机PHP版本

PHP -v     (5.6.30)

那么可以通过brew或者源码  安装这个扩展,最后你会得到一个mcrypt.so 文件。

然后配置,php.ini

如我想以后把所有的PHP扩展都放在/Library/Extensions/PHP_Extension文件夹中,那么就把mcrypt.so这个文件放在/Library/Extensions/PHP_Extension 文件夹中。

编辑php.ini;

在php.ini 文件中找到  ;extension_dir = “./”

改成

extension_dir = “/Library/Extensions/PHP_Extension”

这样就配置好扩展的文件路径。

然后添加一行  extension=mcrypt.so  添加这个扩展。

最后重启Apache 。

这样就完成PHP扩展的安装

 

12 thoughts on “Mac php 扩展目录(mcrypt)

  1. air jordan

    I would like to show appreciation to this writer for rescuing me from this problem. Just after surfing around through the world-wide-web and meeting tips that were not pleasant, I was thinking my entire life was done. Being alive without the presence of answers to the problems you’ve solved through the article content is a crucial case, as well as the kind that might have negatively affected my career if I hadn’t noticed the blog. That know-how and kindness in maneuvering the whole lot was precious. I don’t know what I would’ve done if I hadn’t encountered such a thing like this. I can now relish my future. Thanks so much for the high quality and amazing help. I won’t think twice to refer your web page to anyone who will need guide about this area.

  2. adidas superstar

    I am only writing to make you be aware of what a wonderful encounter my cousin’s girl gained browsing your webblog. She came to understand such a lot of details, not to mention how it is like to possess an amazing giving style to have the rest without problems gain knowledge of a number of hard to do subject matter. You really exceeded our desires. Thanks for rendering these good, safe, explanatory and even cool tips on your topic to Ethel.

  3. nike huarache

    I needed to put you that bit of observation just to say thanks a lot as before just for the marvelous methods you’ve featured on this website. This has been extremely generous of people like you to deliver openly what exactly a few individuals might have sold for an e-book to end up making some bucks on their own, and in particular given that you might well have tried it in case you considered necessary. These tactics in addition acted to provide a great way to fully grasp that other people have the identical desire really like mine to see significantly more with regard to this problem. Certainly there are lots of more enjoyable times up front for many who start reading your blog post.

  4. air max 95

    I am just commenting to let you understand of the really good discovery my child obtained visiting the blog. She mastered lots of things, most notably what it’s like to possess an incredible coaching heart to make many others without difficulty grasp certain complicated matters. You really surpassed our own desires. Thank you for delivering the insightful, safe, educational and as well as unique thoughts on that topic to Gloria.