PostgreSQL access not working in PHP.
Craig White
craigwhite at azapple.com
Wed Mar 23 04:30:31 UTC 2005
On Wed, 2005-03-23 at 14:14 +1100, Neil Dugan wrote:
> On Tue, 2005-03-22 at 19:12 -0700, Craig White wrote:
> > On Wed, 2005-03-23 at 11:12 +1100, Neil Dugan wrote:
> > > I am trying to use PostgreSQL in php under Fedora 3.
> > >
> > > I am using the standard RPM (retrieved by up2date).
> > > PHP 4.3.10 (cgi) (built: Dec 21 2004 09:18:25)
> > >
> > > The php function
> > > function_exists('pg_connect')
> > > always returns FALSE
> > >
> > >
> > > The script below
> > > ----------------
> > > #! /usr/bin/php
> > > <?php
> > > $dbconn = pg_connect ("dbname=mydb");
> > > if (!$dbconn) {
> > > echo "Failed to connect!\n";
> > > exit;
> > > }
> > > ?>
> > > ----------------
> > > Gives the output of
> > > ----------------
> > > PHP Fatal error: Call to undefined function: pg_connect()
> > > in /tmp/test.php on line 3
> > > Content-type: text/html
> > > X-Powered-By: PHP/4.3.10
> > > ----------------
> > >
> > >
> > > phpinfo() says that the 'configure command'
> > > includes '--with-pgsql=shared'
> > ----
> > just for fun...
> >
> > did you install php-pgsql ? 'rpm -q php-pgsql'
> >
>
> Says package not installed.
> BUT the file 'php-pgsql-4.3.10-3.2.i386.hdr' is in '/var/spool/up2date'
> directory.
----
might want to install that - ya think?
----
>
> > you give no 'connect' details...
> >
> > sockets ? TCP/IP ?
> >
> > did you edit /var/lib/pgsql/data/pg_hba.conf for your connection type?
> >
> > Craig
> >
>
> This isn't a problem with PostgreSQL, it is working fine with other
> programs (psql etc.).
----
I think you are gonna have to configure a connection - but first the
php-pgsql
then - second clue...
http://www.php.net/manual/en/function.pg-pconnect.php
Craig
More information about the users
mailing list