Mongodb and MAMP

后端 未结 6 1269
忘了有多久
忘了有多久 2020-12-23 22:40

I am using MAMP and would like to use mongo with PHP. I am stuck because the version of MAMP I\'m using is the latest version I can find, and it\'s running PHP 5.2.11. The

6条回答
  •  醉酒成梦
    2020-12-23 23:25

    For MAMP 2.1.2 and PHP 5.4.10

    1. Download MongoDB php driver .

    2. copy mongo.so to

      /Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debug-non-zts-20100525/
      

      and using temrinal

      cd /Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debug-non-zts-20100525/ && wget https://github.com/downloads/stennie/mongo-php-driver/mongo.so
      
    3. open

      /Applications/MAMP/bin/php/php5.4.10/conf/php.ini
      

      Find ; Extensions

      add extension=mongo.so

    4. Restart MAMP.


    Above steps will install MongoDB driver 1.2.10.

    To install latest Mongodb driver using PECL

    1. install autoconf using homebrew or Mac Ports

      brew install autoconf
      
    2. Download php 5.4.10 source from php.net.

    3. rename uncompressed php source folder from php-5.4.10 to php and paste it in this folder

      /Applications/MAMP/bin/php/php5.4.10/include/
      
    4. using the terminal open php folder and run ./configure

      cd /Applications/MAMP/bin/php/php5.4.10/include/php/ && ./configure
      
    5. Add MAMP bin to your ~/.bash_profile

      echo "export PATH=/Applications/MAMP/bin/php/php5.4.10/bin:$PATH" >> ~/.bash_profile 
      source ~/.bash_profile
      
    6. install latest mongo

      pecl install mongo
      
    7. restart MAMP server :).

提交回复
热议问题