title: Anyway to do MongoDB Sharding in PHP?
body: <p>I have started using MongoDB for one of my PHP project. In that database, i am trying to use MongoDB sharding concept. I got the below link and tried,</p>
  
  <p><a href="https://stackoverflow.com/questions/8552187/mongodb-sharding-example">MongoDB Sharding Example</a></p>
  
  <p>It is working well. But the problem is, in the above example, everything is done in command prompt. But i am trying to do everything in PHP. I am not able to get any example in PHP. </p>
  
  <p>So far, i have started with these piece of codes,</p>
  
  <pre><code>    $connection =   new Mongo();
      $db     =   $connection-&gt;selectDB('TestDB');
      $db     =   $connection-&gt;TestDB;
  
      $connection-&gt;selectDB('admin')-&gt;command(array('addshard'=&gt;'host:port'));
      $connection-&gt;selectDB('admin')-&gt;command(array('enablesharding'=&gt;'TestDB'));
      $connection-&gt;selectDB('admin')-&gt;command(array('shardcollection'=&gt;'TestDB.large', 'key' =&gt; '_id'));
  </code></pre>
  
  <p>It is not working. Also, i dont know how to set shard servers and config database in PHP.</p>
  
  <p>Is there any other way to do MongoDB sharding in PHP?</p>