0

I am new in Mongdb and integrating mongodb in my project. When I connect mongodb remote server in my local system and run the project locally it is working fine. All the queries are working well. But while connecting mongodb on live server it show

"HTTP ERROR 500"

Here is my line of code to connect to the mongodb server:

$conn = new MongoDB\Driver\Manager("mongodb://admin:dgdg4564@38.129.193.112:27010/?authSource=admin");

I am using the same line of code in local system and it is working properly. I also created separate file and add the above line of code and print it but it shows blank screen. Why this is happening. How I should connect to mongodb remote server from live server. Any help will be appreciated.

EdChum
  • 376,765
  • 198
  • 813
  • 562
Sukhpal Singh
  • 525
  • 1
  • 9
  • 29
  • 2
    Enable error reporting and check for errors (https://stackoverflow.com/questions/1053424/how-do-i-get-php-errors-to-display). – Nigel Ren Apr 19 '19 at 07:35

1 Answers1

0

I finally ended up with the solution. I changed my line of code from

$conn = new MongoDB\Driver\Manager("mongodb://admin:dgdg4564@38.129.193.112:27010/?authSource=admin"); 

to

$conn = new MongoDB\Driver\Manager("mongodb://admin:dgdg4564@38.129.193.112:27010/admin?ssl=false");

and it works. May this helps to someone also.

Sukhpal Singh
  • 525
  • 1
  • 9
  • 29