Skip to content

MongoDB and PHP

Looked for a reliable document oriented database, and after some tests and code, decided to give a try on MongoDB for a small proof of concept that i am working on. On the rest of this post i will try to guide you through the main principles of MongoDB integration with PHP.

What is MongoDB ?

MongoDB (from “humongous”) is a scalable, high-performance, open source, dynamic-schema, document-oriented database. Written in C++, MongoDB features:

MongoDB bridges the gap between key-value stores (which are fast and highly scalable) and traditional RDBMS systems.


How to install MongoDB ?

You can follow the great step-by-step article over at If Not True Than Else blog.

How to use MongoDB with PHP ?

Simple as adding a new PECL module.

sudo pecl install mongo

Enable extension on your php.ini file.
Add the line:

Next to your extension list. Restart you web browser instance and you are ready to go.

Starting using your MongoDB with PHP

There are plenty of tutorials and how-to on the internet, although you can start by looking at Mongo tutorials, they are quite detailed and intuitive.

A more detailed with real world examples article can be found at PHPClasses website.

Have you ever used document oriented databases ? What’s your take on this ?

Published inRandom Thoughts

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *