Installing the Php/mongodb extension on Mac OSX 10.8

Source: Internet
Author: User
Tags zts

Installing Php/mongodb extension is a and steps task on OSX:

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

You have a to install autoconf on order to avoid the following error:

Cannot find autoconf. Please check your autoconf installation and the $PHP _autoconf environment variable. Then, rerun the this script. ERROR: ' Phpize ' failed

Enough talk, hands in work ...

Step 1. Install the Autoconf tool

Download the latest source version:

Cdmkdir AUTOCONFCD autoconfcurl 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./configuremakesudo make Installexport 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:

Cdmkdir MONGO-PHP-DRIVERCD Mongo-php-drivercurl Https://codeload.github.com/mongodb/mongo-php-driver/zip/master > Mongo-php-driver-master.zip

Unzip it

Unzip MONGO-PHP-DRIVER-MASTER.ZIPCD Mongo-php-driver-master

Configure and Build

Phpize./configuremake Allsudo make Install

Check 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 are 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 in PHP startup, add the following line to your php.ini file:

Extension=mongo.so

If you don't have a php.ini file that has a to copy it from your Php.ini.default file like this:

sudo cp/private/etc/php.ini.default/private/etc/php.inisudo 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.