title: PHP Connection to Postgre SQL Error
body: <p>I've never connected to a PostgreSQL database before, so this is all new territory. I'm creating an intranet version of a desktop application that we had created for us in our office. I currently have the desktop application installed and it connects to the PostgreSQL database (on a network server) without any hiccups.  I've installed the PostgreSQL odbc drivers and when I use ODBC Data Source Administrator in the Control Panel to test the connection, I get a successful test connection. My issue is when I try to connect directly via a PHP script using all of the same information. I get this error: </p>
  
  <pre><code>Warning: odbc_connect(): SQL error: FATAL: no pg_hba.conf entry for host "10.0.1.218", user "", database "", SSL off, SQL state 28000 in SQLConnect
  </code></pre>
  
  <p>I understand that I could go to the server and change the connection settings (that's if IT allows me to make changes to the server's files... Not counting on that one).</p>
  
  <p>My setup is: Windows XP, XAMPP v. 1.8.2, PHP 5.4, Postgre SQL drivers 9.03.03. My connection information via ODBC Data Source Administrator is: </p>
  
  <pre><code>Data Source - PostgreSQL
  Database - db
  Server - 10.0.0.149
  User Name - user
  SSL Mode - require
  Port - 5432
  Password - password
  Driver - PostgreSQL Unicode
  </code></pre>
  
  <p>The connection string from the desktop application is: </p>
  
  <pre><code>sDeeperConnection = "Server=10.0.0.149;Database=db;User Id=user;Password=password;SSL=true;Pooling=false";
  </code></pre>
  
  <p>The connection string that I've created in PHP is:</p>
  
  <pre><code>$dsn='10.0.0.149';
  $username='user';
  $password='password';
  $dbname='db';
  
  $odb = odbc_connect("Driver={PostgreSQL Unicode};Server=$dsn;SSL=true;Pooling=false;Port=5432;Database=$dbname;", $username, $password);
  </code></pre>
  
  <p>I did notice that the error when I run the PHP script says that SSL 'off' even though I've set it to true, but I don't know how to change this. I've tried 'require' like in the ODBC Data Source Administrator but to no avail. To me it seems that the error (other than the SSL issue) doesn't make sense. I can connect to the PostgreSQL database two different ways on my computer: the desktop application and the ODBC Data Source Administrator. So the issue with there not being an entry for host '10.0.1.218', should be a non-issue in my mind. I've also tried changing the driver I use from PostgreSQL Unicode to PostgreSQL ANSI, but that was also unsuccessful.</p>
  
  <p>I've tried using the <code>pg_connect()</code> function with the same connection parameters after removing the <code>;</code> from these lines php.ini: </p>
  
  <pre><code>;extension=php_pdo_pgsql.dll
  ;extension=php_pgsql.dll
  </code></pre>
  
  <p>But I received the same error. I think it has something to do with the SSL, but I have no idea where to start in testing/debugging the connection using SSL. This problem is a little more difficult due to the fact that I don't have access to the server and getting access to change the files would be like pulling nails.</p>
  
  <p>Any ideas or other options would be great! Thanks ahead of time!</p>
  
  <p><strong><em>EDIT</em></strong>
  Looking in my phpinfo this is what I see:</p>
  
  <pre><code>pgsql
  PostgreSQL Support  enabled
  PostgreSQL(libpq) Version   8.3.3
  PostgreSQL(libpq)   PostgreSQL 8.3.3, compiled by Visual C++ build 1500
  Multibyte character support     enabled
  SSL support     enabled
  Active Persistent Links     0
  Active Links    0 
  
  openssl
  OpenSSL support     enabled
  OpenSSL Library Version     OpenSSL 0.9.8y 5 Feb 2013
  OpenSSL Header Version  OpenSSL 0.9.8y 5 Feb 2013 
  </code></pre>
  
  <p><strong><em>EDIT AGAIN</em></strong></p>
  
  <p>I downloaded pgAdmin III according to the comments below and setup the connection and I'm connecting just fine. So I know that it's not the host. It's something with the SSL setup, I guess. I just have no idea why/how.... Argh...</p>