I need your help. I'm making a project for my thesis and I'm trying to fix this problem for a week without any results. I know that there are a lot of similar topics but I can swear that I didn't find nothing cocern my problem.
I have a web domain on "register.it" where my website has supposed to be. My website need to communicate and handle data from mongo database. So, I have also a remote server (with Ubuntu 16.04) where I install everything correctly (I followed an online guide and tested everything). In fact, locally (I mean, with the mongo shell), there aren't any problem. If I use "systemctl status mongod" it is active. These are other features of the environment:
- php 7.0.30
- mongodb 3.4.16
- mongodb driver 1.5.1
- mongodb database driver 1.6.16
Of course, I also added the extension in the "php.ini" file and allowed the connection from anywhere to the port 27017.
My simple page php have this code:
$mongo = new MongoClient('mongodb://user_of_db_admin:passwd_of_db_admin@151.236.61.166:27017/admin'); echo "Connection to database successfull."
But it doesn't print anything. If I write only the echo, obviously, it will show the text. And if I write this code instead of the echo:
$dbs = $mongo->listDBs(); print_r($dbs);
the page will show this text "listDbs(); print_r($dbs);". In others questions the users complaining because the page showed an error about the connection mongo function (or at least some error message), but I receive only text or a blank page.
I hope you could help me. If there are others information that you need, tell me and I will update my post.