0

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.

Domenico Romano
  • 83
  • 1
  • 1
  • 4
  • Are you sure you are running the code from the server? with the IP/url instead of from the page? – Liora Haydont Jul 17 '18 at 16:00
  • Mmmmh. Now I think I'm running the code not from the server but simply from my domain-web-space. But I thinked that the website could be on that domain and the server would listen and response to my pages. If it's not working like this, I don't know how to do it. Maybe I have to use Plesk that is on the server? (In fact, the phpinfo() didn't work on my domain on register.it, but when I tried it on Plesk space it worked) – Domenico Romano Jul 17 '18 at 16:09
  • By any chance, did you forget to put the ` – Liora Haydont Jul 17 '18 at 17:39
  • Also, you should check this to make sure your errors are showed https://stackoverflow.com/questions/1053424/how-do-i-get-php-errors-to-display – Liora Haydont Jul 17 '18 at 17:52
  • Yes, there's the – Domenico Romano Jul 19 '18 at 08:17

0 Answers0