Install Mongo db on Mac OSX with XAMPP and php 5.3 ext

Hi, I (think) just installed MongoDB on my local xampp machine.

I followed online tutorials and everything seems to be done:

  • Moved the precompiled mongo.so to XAMPP/xampfiles/lib/php/php5.3/extensions/no-debug-non-zts-20090626/

  • Added this line of code in php.ini:

    extension = mongo.so

  • Restart apache

  • Connected to localhost and I see mongo extension in phpinfo()

  • I went http: // localhost: 27017 to see the mongo interface and could not connect to it (Firefox returns an error)

Then I downloaded the MongoHub client for Mac OSX to create / manage mongo databases, but it says there is a socket error and it seems that there is no connection with MongoDB

I (think) I also installed mongoDB myself

  • I created a directory: XAMPP/xampfiles/var/mongodb
  • I extracted the MongoDB tar file under var/mongodb , so now I have var/mongodb/bin
  • From var/mongodb I ran this command:

./bin/mongod

And he returned:

 Sun Sep 11 22:40:32 [initandlisten] MongoDB starting : pid=946 port=27017 dbpath=/data/db/ 64-bit Sun Sep 11 22:40:32 [initandlisten] db version v1.8.3, pdfile version 4.5 Sun Sep 11 22:40:32 [initandlisten] git version: c206d77e94bc3b65c76681df5a6b605f68a2de05 Sun Sep 11 22:40:32 [initandlisten] build sys info: Darwin erh2.10gen.cc 9.6.0 Darwin Kernel Version 9.6.0: Mon Nov 24 17:37:00 PST 2008; root:xnu-1228.9.59~1/RELEASE_I386 i386 BOOST_LIB_VERSION=1_40 Sun Sep 11 22:40:32 [initandlisten] exception in initAndListen std::exception: dbpath (/data/db/) does not exist, terminating Sun Sep 11 22:40:32 dbexit: Sun Sep 11 22:40:32 [initandlisten] shutdown: going to close listening sockets... Sun Sep 11 22:40:32 [initandlisten] shutdown: going to flush diaglog... Sun Sep 11 22:40:32 [initandlisten] shutdown: going to close sockets... Sun Sep 11 22:40:32 [initandlisten] shutdown: waiting for fs preallocator... Sun Sep 11 22:40:32 [initandlisten] shutdown: closing all files... Sun Sep 11 22:40:32 closeAllFiles() finished Sun Sep 11 22:40:32 dbexit: really exiting now 

Running ./bin/mongo also returns:

 MongoDB shell version: 1.8.3 connecting to: test Sun Sep 11 22:41:11 Error: couldn't connect to server 127.0.0.1 shell/mongo.js:79 exception: connect failed 
+4
source share
1 answer

You need to run mongo with this command

 mongod --dbpath=data 

The argument -dbpath = data is the place where your database will be allocated, data is the path and may look like / var / lib / mongodb / data or / data / mongodb.

And after this command, you can go to http: // localhost: 27017 and watch the mongodb monitor.

Good luck

+2
source

All Articles