Getting Postgres and PHP to work together
| From: | Paul Meagher | Date: | Sun, 24 Jun 2001 12:39:14 +0000 |
| Subject: | Getting Postgres and PHP to work together | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-8005@lists.php.net to get a copy of this message | ||
I sucessfully installed the cygwin version of postgres on Windows ME (using
latest version of cygwin distro).
I can connect to the postgres server and create databases using psql.
I am now trying to connect to it from PHP.
I downloaded the latest development snapshot from php4win (php-4.0.7-dev).
I am running php as a module on my windows platform using a recent version
of Apache as the HTTP server.
I configured the relevant extension info in my php.ini
extension_dir = c:/php-4.0.7/extensions/
extension=php_pgsql.dll
I copied all the dlls in the dll directory to my windows/system folder.
I cannot connect to my running postgres server.
I lauched postgres with the following command:
/usr/share/postmaster -i -h 127.0.0.1 -D /usr/share/postgresql/data
Test script:
<?php
$dbconn = pg_connect("host=127.0.0.1 host=5432 dbname=mydb");
?>
Gives me this error:
Warning: Unable to connect to PostgreSQL server: connectDBStart() --
unknown hostname: 127.0.0.1 in c:\apache\htdocs\pg.php on line 2
Any ideas on what I might do to fix the error?
Also, has anybody gotten Postgres and PHP to work together on a Windows ME
setup (or win 98, 95?)?
Regards,
Paul