How to integrate zend framework 2 with mongo db

1.1k views Asked by At

I am trying to integrate zend framework 2 with Mongo DB , can someone please provide the steps or any links to do so.

Query: Can integration be done without using Doctrine 2?

1

There are 1 answers

0
Wil Moore III On

The pre-requisite is that you'll need to install the PECL MongoDB driver:

% sudo `which pecl` install mongo
% sudo sh -c 'echo "extension=mongo.so" > /usr/local/zend/etc/ext.d/mongo.ini'
% sudo ln -nfs /usr/local/zend/etc/ext.d/mongo.ini /usr/local/zend/etc/conf.d/
% sudo `which service` apache2 restart
% if [ `php -m|grep -i mongo` ]; then echo mongodb is installed; else echo mongodb has not been installed; fi

NOTE: This assumes you are using Zend Server CE. If not, the mongo.ini file will need to be created in the directory that your distribution designates as the extension directory:

%   php-config --extension-dir

Once you've gotten that all setup, you can following the tutorial from the PHP manual.