LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-18-2004, 05:50 AM   #1
vickr1z
Member
 
Registered: Mar 2004
Location: manila, philippines
Distribution: RH 7.3
Posts: 63

Rep: Reputation: 15
pg_connect..


good day to all i have this simpe postgres php code that doesnt work.

db_load.php
PHP Code:
<?php
$db_conn 
pg_connect ("host=localhost dbname=testdb");
echo 
"<h1>Connection Information</h1>";
echo 
"Database name: " pg_dbname($db_conn) . "<br>\n";
echo 
"Host name: " pg_host($db_conn) . "<br>\n";
echo 
"Options: " ph_options($db_conn) . "<br>\n";
echo 
"Port: " pg_post($db_conn) . "<br>\n";
echo 
"TTY name: " PG_TTY($db_conn) . "<br>\n";
pc_close ($db_conn);
?>
my error is this:
Code:
Fatal error:  Call to undefined function: pg_connect() in /home/vvbuenaventura/data/projects/web/polmap_akbayan/pgstart.php on line 3
what behind this error means?
is it related to tcp/ip connection to postgresql?
i set tcp/ip = true on my postgresql.conf

hope you could help me here.. thanks in advance..

kriz
 
Old 10-18-2004, 03:59 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
I have never used Postgres in conjunction with PHP
so far, but my educated guess would be that PHP wasn't
compiled with postgres-support/doesn't know anything
about Postgres in your installation since it says:
"undefined function"

That makes it (to me) appear as a problem of the
programming language/it's interface.


Cheers,
Tink
 
Old 12-19-2004, 11:36 PM   #3
alejandroye
Member
 
Registered: May 2004
Location: SOUTH FLORIDA USA
Distribution: MANDRIVA / CENTOS
Posts: 146

Rep: Reputation: 15
I having the same problem but I do not know what to do, I need some help about this
Looking about this problem I found this note in some website but I still do not know what to do HELP

==========================
"After upgrading to PHP 4.2.3 from PHP 4.1.2 (Red Hat Linux Advanced Server with Stronghold 4.0) in order to manually compile in MHASH support, I discovered that Postgres support has disappeared, despite being specified on the command line, and compiling with no errors.

FATAL: Undefined function: pg_connect()

Confirmed by looking at the output of phpinfo() and comparing it to the output pre-upgrade - no mention of PostgreSQL in the new one.

Detective work led me to find that the old pgsql.so in /usr/lib/php4 was untouched, and the new one had ended up in /usr/lib/20020429 instead.

The fix was to edit config_vars.mk after configuration to change the value of EXTENSION_DIR, and then compile.

Not quite sure where 20020429 came from, looks like a left-over value from development testing...

Anyway, in case any one else has a similar problem, thought I'd document it here, as a problem with pg_connect is where this will first surface as a symptom.
"
===========
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration