Re: [PHP-DB] Fatal error: Call to undefined function: pg_connect() in .....

2002-07-18 Thread Miles Thompson

Is PostgreSQL started with the -i switch? (I think that's the one; it 
exposes it to tcp/ip connections.)  Check your PGSQL docs to be certain.

Have you run a page with phpinfo? Is PostgreSQL support compiled into your 
installation of PHP? This is a file consisting of
? phpinfo(); ?, named phpinfo.php. Again, I'm doing this from memory but 
I'm pretty certain of the function name.

If you have a yes to those questions, then we can start on the rest. Check 
to see if there is a pg_error function you can call if the connection 
fails. Keep error reporting at a high level so we can see what they are.

Regards - Miles Thompson

At 06:37 PM 7/18/2002 -0700, Vincent wrote:
Hi, I'm a newbie here. I don't know what went wrong.
I've tried searching for solutions and can't find any.
How come pg_connect() isn't defined? Should I include
any header files or something in php?

Here's my code:

?php $conn = pg_connect(dbname=phpdb); if (!$conn) { echo Unable to 
connect to database
; } else print Connected; ?
I've tried installing Apache's rpm and Php's rpm. I'm
running on RedHat Linux 7.3. apache_1.3.23-11.i386.rpm
and php-4.1.2-7.rpm. Then, it still gives me the error
message. So, I tried the gz version using
apache_1.3.26.tar.gz and php-4.2.1.tar.gz. Nothing
works. I've tried looking into the php.ini files,
adding extension to pgsql.so.

Have any of you encountered this problem before?

__
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Fatal error: Call to undefined function: pg_connect() in ...

2001-10-29 Thread Rick Emery

This means that PostgreSQL support was NOT compiled into PHP.  Therefore,
you cannot use PostgreSQL commands.

-Original Message-
From: Rodolfo Napoles [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 29, 2001 2:17 PM
To: [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
titleTESTING PHP4 with PG/title
/head
body bgcolor=#FF topmargin=10 leftmargin=10
p align=centerstrongTesting 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Fatal error: Call to undefined function: pg_connect() in ...

2001-10-29 Thread Rodolfo Napoles

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:[EMAIL PROTECTED]]
 Sent: Monday, October 29, 2001 2:17 PM
 To: [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
 titleTESTING PHP4 with PG/title
 /head
 body bgcolor=#FF topmargin=10 leftmargin=10
 p align=centerstrongTesting 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: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Fatal error: Call to undefined function: pg_connect() in ...

2001-10-29 Thread Fotwun

Compile a dynamic module for use with the dl() function or the php.ini.

./configure --with-pg=shared
make

cp the module in the src/module (pgsql.so) into the location defined for
modules in your php.ini.

either add line to the ini or use the dl('pgsql.so') in your script to call
it.

if you are using a windows box i'm not sure what you do, besides first
switching to an open source OS =). they may already have binaries for
windows modules, though in my experience on unix boxes is that it compares
the the version of php you are running against the version it was compiled
with. if they are different it will error. so watch for that if you find a
compiled module to use. if you do not have access to modify the ini or place
files in the appropriate library directory you will have to request your
admin to do it. if they do not you will need to find another host or use
your own server.

 -Original Message-
 From: Rodolfo Napoles [mailto:[EMAIL PROTECTED]]
 Sent: Monday, October 29, 2001 1:43 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Fatal error: Call to undefined function:
 pg_connect() in ...


 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:[EMAIL PROTECTED]]
  Sent: Monday, October 29, 2001 2:17 PM
  To: [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
  titleTESTING PHP4 with PG/title
  /head
  body bgcolor=#FF topmargin=10 leftmargin=10
  p align=centerstrongTesting 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: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]