I am quite new in PHP and databases. I am trying to connect to a remote Postgres database from my computer. In the past I have done this by using a localhost and a MySQL database but it is the first time that I try to connect in another host. This is the PHP code that I have:
<?php
$conn_string = "host=hostname.com port=xxxx dbname=dbname user=root password=root";
$dbconn = pg_connect($conn_string);
?>
I read several articles in internet saying that it is enough to change the hostname from localhost to the one provided but it doesn't seem to work. I also have deactivated my firewall in case there is some problem with the communication but with no success.
As I said I am quite new with this and in the past I had used only test servers (localhost). Back then I was using software like Wamp and Mamp and I was placing the script files in the localhost.
So, my questions are: 1) where should I save the test.php file which has the above lines of code? 2) Would this solve the problem or I am missing some important concept here?
I hope what I am trying to say is clear. Please let me know if I have to be more specific in something.
Thanks Dimtiris