zoukankan      html  css  js  c++  java
  • Installing the PHP/MongoDB extension on Mac OSX 10.8

    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/
  • 相关阅读:
    第4章 函数
    第3章 文件处理和函数
    第2章 数据类型
    第 8章 面向对象补充和网络编程
    第7章 面向对象
    第6章 常用模块
    第 5 章 函数的补充和模块加载
    git 使用命令提交文件
    jquery 读取本地json文件数据
    mpvue 封装api请求接口
  • 原文地址:https://www.cnblogs.com/zendwang/p/4736608.html
Copyright © 2011-2022 走看看