Search Postgresql Archives

PHP and Postgresql on Windows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
 

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux