如何使用PHP远程连接到mongodb

I have mongodb installed in lab computer and I have written the php code to connect to it.

 <?php

     $server="mongodb://172.27.20.188:27017/test_database";
     $m=new Mongo($server);
     if ($m->connected)
        {echo "succesful";}
     else
        {echo "failed";}
?>

When I am running it on local machine command line, it is showing me successful. But when I try to access it from another machine browser, the page is not working. I have also tried commenting out the line bind_ip in mongodb.conf.