title: PHP and MongoDB
body: <p>I am trying to connect to MongoDB via PHP.</p>
  
  <pre><code>mongod --version
  db version v3.2.8
  </code></pre>
  
  <p>Then, </p>
  
  <pre><code>php -i | grep mongo
   /etc/php/7.0/cli/conf.d/20-mongodb.ini,
   mongodb
   mongodb support =&gt; enabled
   mongodb version =&gt; 1.1.8
   mongodb stability =&gt; stable
   libmongoc version =&gt; 1.3.5
   mongodb.debug =&gt; no value =&gt; no value
  </code></pre>
  
  <p>I tried:</p>
  
  <pre><code>sudo pecl install mongodb
  </code></pre>
  
  <p>which returns </p>
  
  <pre><code>pecl/mongodb is already installed and is the same as the released version 1.1.8 
  install failed
  </code></pre>
  
  <p>which (the install failed bit) gets redressed if I try:</p>
  
  <pre><code>sudo pecl uninstall mongodb
  </code></pre>
  
  <p>and</p>
  
  <pre><code>sudo pecl install mongodb
  </code></pre>
  
  <p>I have this php file:</p>
  
  <pre><code>&lt;?php
  
  echo "I am here";
  $connection = new Mongo('localhost');
  $db = $connection-&gt;mydb;
  
  $list = $db-&gt;listCollections();
  foreach ($list as $collection) {
      echo "$collection &lt;/br&gt;";       
  }
  
  echo "I am never here";
  ?&gt;
  </code></pre>
  
  <p>I cannot see the second echo. </p>
  
  <p>I would appreciate any thoughts. </p>
  
  <p>Thank you.</p>