PHP:Mongodb使用IP连接到服务器

I am trying to connect to a mongodb server in my php file which is on my local. The mongodb server is on another server whose IP i know. There is no username and password set on the server for the mongodb. I have installed the php driver for mongodb too as required on my system.

Mongodb is working fine on the server. I have checked that.

When i run my php script its giving error: *The website encountered an error while retrieving http://localhost/test/mongo_test.php. It may be down for maintenance or configured incorrectly.*

Is there anything else i need to configure ? If yes where? and also how?

The server most likely has a firewall in place not allowing outside access to the particular port MongoDB is running on for security purposes.