| Installing MongoDB on Mac OS X 1. Open the Terminal app and type % brew update
2. After updating Homebrew % brew install mongodb
After downloading Mongo, create the “db” directory. This is where the Mongo data files will live. You can create the directory in the default location by running % sudo mkdir -p /data/db
% sudo chown [user_name] /data/db
Run the Mongo daemon, in one of your terminal windows run % mongod
This should start the Mongo server. Run the Mongo shell, with the Mongo daemon running in one terminal, type below in another terminal window. mongo
- This will run the Mongo shell which is an application to access data in MongoDB.
- To exit the Mongo shell run quit()
- To stop the Mongo daemon hit ctrl-c
Installing MongoDB Driver running on PHP
- Before installing MongoDB driver, you should check your PHP version first. Actually there are various version of PHP version. In my case, php version is 7.1.7
%php -ver
PHP 7.1.7 (cli) (built: Jul 15 2017 18:08:09) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
|