[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Postgre/PHP installation woes




Thanks to everyone for the helpful replies (my original post is below, under the $$$$ line). It appears that PHP is not connecting to our postgre database, as indicated by the following error that appears on the main PHP web page:

Parse error: parse error in /var/www/srp/dbconnect.php on line 5

I've taken the following actions in response to the assistance you've offered:

1) Checked to see that the database (called "ourdb") is in fact available by entering "psql ourdb." The database opens up to an "ourdb" prompt. However, "locate ourdb" does not return a location for the DB.

2) Made sure that postgresql is running by outputting ps ax:

  xxx ?        S      0:00 /usr/lib/postgresql/bin/postmaster
  xxx ?        S      0:00 postgres: stats buffer process
  xxx ?        S      0:00 postgres: stats collector process

3) Altered the pg_hba.conf (located in /etc/postgresql) to reflect the following, and re-started postgre:

#local all ident sameuser
local        all                                           trust
host all 127.0.0.1 255.0.0.0 ident sameuser
host         all         0.0.0.0       0.0.0.0             reject

4) Made sure that the php4-pgsql module is present -- I did an "apt-get" for this last week

5) Examined the postgresql log for clues -- the log file is empty, indicating that no login attempts have been made -- I suppose because the auth.php has not found the DB.

6) pg_exec call deprecated under PHP 4.2.0 and replaced with pg_query: since we're using php 4.1.2-6wood, it seems that this does not apply to our setup. Correct?

7) Finally, examined the first 10 lines of auth.php:

<?
        include('dbconnect.php');
        include('util.php');
        include( 'login.php' );

        if( $real_login )
        {
$sql = "select fname, lname, password, admin_flag, client_id from usr where login = " . sqlstr(
$real_login);

                $result = pg_exec( $link, $sql );

This led me to examine "dbconnect.php" -- the following line is present:

 $link = pg_connect ("", "", "", "", "ourdb" or
                        die ( "Could not connect to database." );

All suggestions welcome. Solution guaranteed posted to the list.

- Danny O'Brien




$$$$$$$$$$$$$$$$$$$$$$

Original post:

Any postgre experts out there? We have a PHP4 site that worked fine under a previous RedHat build, but we just can't get it working on this Debian build.

Here's what we're running:

Debian 3.0r1 "woody"
Kernel 2.4.18-bf2.4
Apache 1.3.26-0woo
postgres 7.2.1-2wood
php 4.1.2-6wood

We've applied a script sent to us by the original programmers, that installed several logins and passwords. But when we go to login to our PHP site, our login is rejected and we get the following error:

Warning: Supplied argument is not a valid PostgreSQL link resource in <path>/auth.php on line 10

Line 10 in auth.php looks like this:

$result = pg_exec( $link, $sql );

We've attempted to log in many times, so we know we're not mis-typing the password. Is the login prompt not hitting the database?

TIA for any suggestions,

Danny O'Brien



Reply to: