пятница, 25 февраля 2011 г.

Installation mongodb+php on Ubuntu/Debian

By looking in internet for way to install mongodb driver I have found only truncated instructions. And there will be my complete guide :)

First of all we need to install mongodb server:
 sudo aptitude install mongodb  
And try whether it works:
 $ mongo  
 MongoDB shell version: 1.6.6-pre-  
 connecting to: test  
 > show dbs  
Now we can install pear
 sudo apt-get install php5-dev php-pear  
and download & install mongodb driver for php
 sudo pecl install mongo
now we have to create file /etc/php5/conf.d/mongo.ini and write 1 line in it
restart apache
 sudo /etc/init.d/apache2 restart  
and try some php code like that:
 var_dump(new Mongo());  
in my case output was
 object(Mongo)#1 (4) {  
  string(0) ""  

Комментариев нет:

Отправить комментарий