Installing PHP/MongoDB extension is a two steps task on OSX:

  • Install the autoconf tool required for compiling the extension
  • Install the Mongo extension

You have to install autoconf in order to avoid the following error:

Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script.

ERROR: `phpize’ failed

Enough talk, hands on work…

Step 1. Install the autoconf tool

Download the latest source version:

cd
mkdir autoconf
cd autoconf
curl http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz > autoconf.tar.gz

Untar it

tar -xvzf autoconf.tar.gz

Configure and make

cd autoconf-2.69
./configure
make
sudo make install
export PHP_AUTOCONF=/usr/local/bin/autoconf

autoconf is installed on /usr/local/bin/autoconf by default.

Step 2. Install the Mongo extension

Download the driver from the official repository:

cd
mkdir mongo-php-driver
cd mongo-php-driver
curl https://codeload.github.com/mongodb/mongo-php-driver/zip/master > mongo-php-driver-master.zip

Unzip it

unzip mongo-php-driver-master.zip
cd mongo-php-driver-master

Configure and build

phpize
./configure
make all
sudo make install

Check that the extension was successfully created:

ls /usr/lib/php/extensions/no-debug-non-zts-20090626/

You should see the mongo.so extension file in there.

Make sure the previous directory is the same as the PHP extension directory by running:

php -i | grep extension_dir
extension_dir => /usr/lib/php/extensions/no-debug-non-zts-20090626 =>
/usr/lib/php/extensions/no-debug-non-zts-20090626

If it’s not, change the extension_dir in php.ini or move mongo.so. (See below if you don’t have a php.ini file)

To load the extension on PHP startup, add the following line to your php.ini file:

extension=mongo.so

If you don’t have a php.ini file you have to copy it from your php.ini.default file like this:

sudo cp /private/etc/php.ini.default /private/etc/php.ini
sudo nano /private/etc/php.ini

Add the previous “extension” line to your file, save it and restart apache

sudo apachectl restart

From:http://andres.jaimes.net/857/setup-php-mongo-on-mac/

Installing the PHP/MongoDB extension on Mac OSX 10.8的更多相关文章

  1. XE6移动开发环境搭建之IOS篇(8):在Mac OSX 10.8中安装XE6的PAServer(有图有真相)

    网上能找到的关于Delphi XE系列的移动开发环境的相关文章甚少,本文尽量以详细的图文内容.傻瓜式的表达来告诉你想要的答案. 原创作品,请尊重作者劳动成果,转载请注明出处!!! 安装PAServer ...

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

    网上能找到的关于Delphi XE系列的移动开发环境的相关文章甚少,本文尽量以详细的图文内容.傻瓜式的表达来告诉你想要的答案. 原创作品,请尊重作者劳动成果,转载请注明出处!!! 在安装Xcode前, ...

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

    网上能找到的关于Delphi XE系列的移动开发环境的相关文章甚少,本文尽量以详细的图文内容.傻瓜式的表达来告诉你想要的答案. 原创作品,请尊重作者劳动成果,转载请注明出处!!! 以下内容比较长,我们 ...

  4. 虚拟机VMware 9安装苹果MAC OSX 10.8图文教程

    前些天虚拟机VMware Workstation 9出来,相信大家都已经熟悉VM9了,至于MAC OSX 10.8系统,那也是出来一段时间了,本篇文章就是来讲解VMware Workstation 9 ...

  5. 深度学习框架-caffe安装-环境[Mac OSX 10.12]

    深度学习框架-caffe安装 [Mac OSX 10.12] [参考资源] 1.英文原文:(使用GPU) [http://hoondy.com/2015/04/03/how-to-install-ca ...

  6. 深度学习框架-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 ...

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

    XE6移动开发环境搭建之IOS篇(7):在Mac OSX 10.8中安装XE6的PAServer(有图有真相) 2014-08-22 21:06 网上能找到的关于Delphi XE系列的移动开发环境的 ...

  8. 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 ...

  9. Setup Tensorflow with GPU on Mac OSX 10.11

    Setup Tensorflow with GPU on OSX 10.11 环境描述 电脑:MacBook Pro 15.6 CPU: 2.7GHz 显卡: GT 650m 系统:OSX 10.11 ...

随机推荐

  1. Java免费开源数据库、Java嵌入式数据库、Java内存数据库

    Java免费开源数据库.Java嵌入式数据库.Java内存数据库 http://blog.csdn.net/leiyinsu/article/details/8597680

  2. php截取小时和分钟,在进行和其它时间段的比较

    用php截取时间的小时和分钟,然后判断这个时间是不是在 8:00到11:30之间,用php应该怎么写? date_default_timezone_set("Asia/Shanghai&qu ...

  3. Linux下OpenSSL 安装图文详解

    安装环境:        操作系统:CentOs6.3 OpenSSL Version:openssl-1.0.0e.tar.gz 目前版本最新的SSL地址为http://www.openssl.or ...

  4. 如何设置EditPlus的默认编码utf-8方式

    最近在使用英文版的Editplus写代码的时候,发现中文字符在调试过程中都变成了乱码,发现是Editplus编码设置的问题,Editplus默认编码可能是ANSI,需要将其改成UTF-8.干脆给设置默 ...

  5. YII AR查询方法

    ActiveRecord类文档:http://www.yiiframework.com/doc/guide/1.1/en/database.ar 对于一个Model Post 有如下的4中查询方法,返 ...

  6. RESTFul API 一些文章

    http://www.ibm.com/developerworks/cn/web/1103_chenyan_restapi/index.html

  7. NOI2014 起床困难综合症

    3668: [Noi2014]起床困难综合症 Time Limit: 10 Sec  Memory Limit: 512 MBSubmit: 225  Solved: 153[Submit][Stat ...

  8. 微支付开发(.net)

    最近一周多进行微支付开发工作,总结一下关于微支付开发中遇到的问题. 如写得不对请大家提出,第一次自己写文章.嘿嘿... 1.申请微支付,登陆公众平台后(公众号为服务号并已认证),进入“服务”-“服务中 ...

  9. UVA 11426 GCD - Extreme (II) 欧拉函数

    分析:枚举每个数的贡献,欧拉函数筛法 #include <cstdio> #include <iostream> #include <ctime> #include ...

  10. C# VS2010中,用微软自带的System.Data.OracleClient来连接Oracle数据库

    由于微软在.Net框架4.0中已经决定撤销使用System.Data.OracleClient,造成在VS2010中无法连接Oracle数据库,但它还依旧存在于.Net架构中,我们可以通过自己引用 C ...