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. 剖析 Linux hypervisor--KVM 和 Lguest 简介

    慢慢弄清楚..   M. Tim Jones, 顾问工程师, Emulex Corp. M. Tim Jones 是一名嵌入式软件工程师,他是 Artificial Intelligence: A S ...

  2. JAVA抽象类与接口

    在Java语言中, abstract class 和interface 是支持抽象类定 义的两种机制.正是由于这两种机制的存在,才赋予了Java强大的 面向对象能力.abstract class和in ...

  3. Android-加载透明PNG图片变黑的问题

    png和jpg作为两种最常用的图片格式,首先我们要知道他们的区别: 1.从一般图片的外观上来说,他们是无法直接判断的 2.从文件大小上来说,同样一张图png肯定比jpg的大 3.通过查资料咱们可以发现 ...

  4. Java之sleep和wait的区别

    这个问题在面试线程方面的知识时,基本上属于必问的问题.因此这里有必要做一个较为详细的总结. 区别一 首先需要明白的是这两个方法根本来自不同的类,sleep来自Thread,wait来自Object类. ...

  5. USACO3.23Spinning Wheels

    直接枚举角度 数据比较水吧 /* ID: shangca2 LANG: C++ TASK: spin */ #include <iostream> #include<cstdio&g ...

  6. hdu1838Chessboard(DP)

    http://acm.hdu.edu.cn/showproblem.php?pid=1838 其实原先不知道这题是DP 我都想不到DP去 想了想没思路 看了下题解 经典思路 :第n大的都是由第n-1大 ...

  7. css揭秘之linear-gradient

    很神奇的背景设置, 看代码, <html> <title>css</title> <style> .content { background: line ...

  8. cogs_396_魔术球问题_(最小路径覆盖+二分图匹配,网络流24题#4)

    描述 http://cojs.tk/cogs/problem/problem.php?pid=396 连续从1开始编号的球,按照顺寻一个个放在n个柱子上,\(i\)放在\(j\)上面的必要条件是\(i ...

  9. Master Nginx(4) - Nginx as a Reverse Proxy

    Introduction to reverse proxying the proxy module legacy servers with cookies the upstream module ke ...

  10. Mater Nginx(2) - A Configuration Guide

    The basic configuration format Nginx global configuration parameters Using include files The HTTP se ...