简体   繁体   中英

Install PHP driver for MongoDB on MAMP

I'd like to install the PHP driver on MAMP 1.9.6 (OS X 10.5.8) and PHP 5.3

I did all the stuff said on http://www.mongodb.org/display/DOCS/PHP+Language+Center But it still won't work.

If i try to connect it throws an error "Fatal Error: Class 'Mongo' not found" But in PHPStorm the Mongo class is found and autocomplete works. I added the extension in the php.ini

To install Mongo in terminal I wrote

sudo /Applications/MAMP/bin/php5.3/bin/pecl install mongo

And everything was installed properly.

What am I doing wrong?

  1. using the package manager of your choice (ie homebrew, port, apt-get, etc) install mongo
  2. set up your MAMP environment to install additional extensions following this tutorial: http://blog.jellystyle.com/post/37099202581/installing-php-extensions-with-mamp
  3. once your mamp is ready, run sudo pecl install mongo
  4. restart mamp service
  5. you should be able to run phpinfo() in a browser and find Mongo down there (and it should be the latest version)

I believe you have to do the following first:

sudo port install mongodb

I followed this link when installing and had no problems: Apache, PHP and MongoDB on Mac OS X

Follow this guide:

http://www.davidgolding.net/mongodb/installing-mongodb-on-mamp-1-9-5.html

The key part is grabbing the driver binary here: https://github.com/mongodb/mongo-php-driver/downloads

Copy the binary to the location stated in the guide, then make the change to your php.ini file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM