Re: [PHP-DB] Fatal error: Call to undefined function: pg_connect() in ... From: Rodolfo Napoles (rodolfo.napoles <email protected>)
Date: 10/29/01

Is there a way to configure php (through the conf file?) to support the pg
commands? Is there a manual (link) where I can find how to compile postgreSQL
support into PHP? does it mean to compile PHP ?

Thanks

Rick Emery wrote:

> This means that PostgreSQL support was NOT compiled into PHP. Therefore,
> you cannot use PostgreSQL commands.
>
> -----Original Message-----
> From: Rodolfo Napoles [mailto:rodolfo.napoles <email protected>]
> Sent: Monday, October 29, 2001 2:17 PM
> To: php-db <email protected>
> Subject: [PHP-DB] Fatal error: Call to undefined function: pg_connect()
> in ...
>
> Hello,
>
> I am trying to run my first php script to connect to a PostgreSQL
> database on a Linux box with apache web server.
>
> When I try to load the page with the browser i get the following error:
>
> Fatal error: Call to undefined function: pg_connect() in
> /dirname/tryit.php on line 9
>
> I was able to create tables on the database via the webadmin tool, so I
> know that postgres is running properly.
>
> Here is my code.
>
> <html>
> <head>
> <title>TESTING PHP4 with PG</title>
> </head>
> <body bgcolor="#FFFFFF" topmargin="10" leftmargin="10">
> <p align="center"><strong>Testing connection to Postgres using php4 from
> an apache webserver on Linux Mandrake 8.0</strong></p>
> <?php
> $conn = pg_connect("host=localhost dbname=databasename");
> if (! $conn) { ?>
> <p> Can not open connection to Database, contact the site
> administrator </p> <?php
> }
> else
> {
> $SQL = "SELECT * FROM TABLENAME";
> $rs = pg_query($SQL, $conn);
> if (! $rs) {?>
> <p> Can not execute SQL statement, contact the site
> administrator </p> <?php
> }
> else
> {
> do {
> while ($row = pg_fetch_row($rs)) { ?>
> <p> <?php echo $row; ?> </p> <?php
> }
> } while (pg_next_result($rs));
> pg_freeresult($rs);
> pg_close ($conn);
> }
> }
> ?>
> </body>
> </html>
>
> Thanks in advance
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe <email protected>
> For additional commands, e-mail: php-db-help <email protected>
> To contact the list administrators, e-mail: php-list-admin <email protected>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>