title: Installing and starting MongoDB for PHP on Ubuntu 12.04
body: <p>I have installed the <code>mongo</code> extension from PECL and added it to my <code>php.ini</code> file. The extension loads when I run <code>phpinfo();</code> but shows me this error when I try to connect to the Mongo Server.</p>
  
  <pre><code>Fatal error: Uncaught exception 'MongoConnectionException' with message 'Transport
  endpoint is not connected' in /var/www/mongo.php:2 Stack trace: #0 /var/www/mongo.php(2):
  Mongo-&gt;__construct() #1 {main} thrown in /var/www/mongo.php on line 2
  </code></pre>
  
  <p><code>phpinfo();</code> tells me its running on localhost at the default port.</p>
  
  <p>Also I installed the <code>mongodb_client</code> package for Ubuntu, which also fails to connect on the default server running when I use it from the terminal, although it can connect to the server on <em>MongoLab</em>. The PHP Script also fails to connect to the <em>MongoLab</em> server.</p>
  
  <p>After reading many questions and answers on SO and other sites, I guess my MongoDB server on my computer is not turned on. All the articles tell me to go to some folder where MongoDB may be installed, but I dont have any folder in <code>/var/lib</code> or in <code>/usr/lib</code></p>
  
  <p>Please help me get this MongoDB working, I want to continue to on learn MongoDB from the <strong>MongoDB and PHP</strong> book by Steve Francia. The book doesn't have a good tutorial on installing MongoDB.</p>
  
  <p>Thanks.</p>