开发者

Mongo db installation on Mac osx with XAMPP and php 5.3 ext

开发者 https://www.devze.com 2023-04-04 16:23 出处:网络
Hi I (think) just installed MongoDB to my local xampp machine. I followed tutorials online and all seems to be done:

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

I followed tutorials online and all seems to be done:

  1. Moved pre-compiled mongo.so into XAMPP/xampfiles/lib/php/php5.3/extensions/no-debug-non-zts-20090626/

  2. Added this line of code into php.ini:

    extension = mongo.so

  3. Restarted Apache

  4. Connected to localhost and I can see the mongo extension in phpinfo()

  5. Went to http://localhost:27017 to see mongo interface and couldn't connect to it (Firefox returns an error)

Then I downloaded the MongoHub client for mac osx to create/manage mongo databases, but it says socket error, and seems there is no connection to MongoDB

I (think) I installed also mongoDB itself

  1. I created a directory: XAMPP/xampfiles/var/mongodb
  2. I excracted tar MongoDB package file under var/mongodbso now I have var/mongodb/bin
  3. From var/mongodb I launched this command:

./bin/mongod

And it 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 versi开发者_JAVA技巧on: 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

Launching ./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


You have to start mongo with this command

mongod --dbpath=data

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

And after that command you can go to http://localhost:27017 and see the mongodb monitor.

Good luck!

0

精彩评论

暂无评论...
验证码 换一张
取 消