WARNING: The following post talks about an Ubuntu version that is at end of life. It's highly recommended that you upgrade your server to a newer Ubuntu version.

Installing the PHP module for MongoDB on Ubuntu 14.04 LTS is just a command away, but first, let’s ensure that we have MongoDB itself installed:

sudo apt-get install mongodb

Once we have MongoDB installed, we can proceed with installing the module. Please note that you could combine these commands to install MongoDB and the module in one shot:

sudo apt-get install php5-mongo

Once installed, you will want to restart your web server and/or process manager (spawncgi, php-fpm, et cetera). Once you’ve done so, you can pull up phpinfo() and you should see a new section for MongoDB. You are now ready to interact with MongoDB from your PHP scripts!

Did you enjoy this post?

Cool if I slip into your inbox with more?
Full posts, 1-2 times per week: