PHP and Postgresql on Windows

From: typing80wpm(at)aol(dot)com
To: pgsql-general(at)postgresql(dot)org
Subject: PHP and Postgresql on Windows
Date: 2005-04-22 19:12:37
Message-ID: 8C7158661C832F6-5CC-2E124@mblk-d48.sysops.aol.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I searched on goolge and found my answer, I think.

>From what I see (below), all I need to do is a WAMP install from one of the CDs in the back of the PHP books I bought, and then un-comment the extension=php_pgsql.dll



http://www.sitepoint.com/article/use-postgresql-php-windows/3

Connect to PostgreSQL from PHP

Open your php.ini file (most likely located in c:\winnt), find the section called Dynamic Extensions and un-comment the line that contains "extension=php_pgsql.dll". Save and close php.ini and restart Apache. If the Web server complains and says it's unable to load the dynamic library, you probably have entered the wrong path for extension_dir in php.ini (section Paths and Directories). Another possible -– though unlikely -- cause is that the file php_pgsql.dll isn't present in the extensions directory.

Now you should be able to run the following little PHP script:

<?
$conn = pg_connect("host=localhost
port=5432
dbname=template1
user=postgres
password=********");
$sql = "SELECT current_date AS today;";
$result = pg_query($conn, $sql);
$row = pg_fetch_object($result, 0);
echo "Today is: " .$row->today;
?>


The script isn't too exciting, but at least it shows you how to connect to the database and execute a query.

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-04-22 19:13:35 Re: libpq Unicode support?
Previous Message Sven Willenberger 2005-04-22 19:09:13 Re: plperl function fails to "fire" Slony trigger