Re: [OT] Accessing PostgreSQL through Apache and PHP4

From: wsheldah(at)lexmark(dot)com
To: "Holt, Jack C(dot)" <JACK(dot)C(dot)HOLT(at)saic(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [OT] Accessing PostgreSQL through Apache and PHP4
Date: 2001-10-18 18:58:39
Message-ID: 200110181859.OAA09930@interlock2.lexmark.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

This looks like a php/Apache problem. During my brief fling with php, I got
best results when I built apache and php together using apachetoolbox from
apachetoolbox.com. Running Slackware, I had postgresql in the standard
/usr/local/pgdata directory, and the apachetoolbox scripts found it there and
built support for it into php. Relatively painless.

Ultimately, I ditched php in favor of using mod_perl and Mason, mainly because
php database calls were SO database specific and I couldn't find a decent
abstraction layer, and also because I couldn't find a decent templating
solution. I found some attempts at both, but DBI and Mason are years ahead in
terms of features. ObDisclaimer: I've been using perl for several years now, so
that may have unfairly raised my expectations or otherwise biased my evaluation.
:-)

Wes
P.S. Even more OT: Anyone know how to access email on a domino server using a
generic linux mail client? No, I don't believe our domino server is set up to
support IMAP or POP.

"Holt, Jack C." <JACK(dot)C(dot)HOLT%saic(dot)com(at)interlock(dot)lexmark(dot)com> on 10/18/2001
10:55:42 AM

To: pgsql-general%postgresql(dot)org(at)interlock(dot)lexmark(dot)com
cc: (bcc: Wesley Sheldahl/Lex/Lexmark)
Subject: [GENERAL] Accessing PostgreSQL through Apache and PHP4 on Linux

I am running PostgreSQL 7.1.3, RedHat 7.1 (kernel 2.4.2-2), and PHP/4.0.4pl1.
When I try to run a PHP page found below I get an error that says:

Fatal error: Call to undefined function: pg_connect() in
/var/www/html/psolver.php on line 10

Additionally, even though pgsql.so IS in /usr/lib/php4 (and php.ini tells PHP to
look there for extensions), I get the following error on the call to dl().

Warning: Unable to load dynamic library '/usr/lib/php4/pgsql.so' - libpq.so:
cannot load shared object file: No such file or directory in
/var/www/html/psolver.php on line 7

Code snippet:

-----------------------------------------------------------------------------------------------

<?

  dl("pgsql.so");

  //connect to database

  $conn = pg_connect("","","","psolver");

  if(!$conn) {

    print("Couldn't connect to psolver");

    exit;

  }

?>

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-10-18 18:59:09 Re: FTI Queries and Explain (long)
Previous Message Tom Lane 2001-10-18 18:54:43 Re: Can not input large text data