ID: 15282
Comment by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Status: Assigned
Bug Type: PostgreSQL related
Operating System: Solaris 2.8
PHP Version: 4.1.1
Assigned To: yohgaki
New Comment:

I've also tried using the current CVS (01/26/2002) with no luck. The
are no multiple copies of libpq, it's a new system.

I haven't tried running iPlanet under gdb yet, that'll be something to
try tommorow.

In the mean time, here's the error from the logs:

[29/Jan/2002:22:50:18] info (14848): for host b-39-117-res1.mts.net
trying to POST /members.php, PHP_log_message reports: PHP Warning: 
Unable to connect to PostgreSQL server:  connectDBStart() -- connect()
failed: No such file or directory
        Is the postmaster running (with -i) at 'db1'
        and accepting connections on TCP/IP port 5432?
 in /usr/local/etc/httpd/htdocs/cardp.ca/members.php on line 100

No other errors appear and the server keeps on running.

The source of the script (sans-HTML) calling the database follows:


<?

        $db = pg_connect("host='db1' user='cardp' dbname='cardp'");
        if(!$db) {
                echo "\nAn error occured connecting to the database.\n";
                exit;
        }

        if($alpha=="Show All") {
        $query = "SELECT last_name, first_name, address1, address2, address3,
                                        city, province, country, postal_code, email 
                                FROM members WHERE active = TRUE ORDER BY last_name";
        } else {
        $query = "SELECT last_name, first_name, address1, address2, address3,
                                        city, province, country, postal_code, email 
                                FROM members WHERE active = TRUE AND last_name LIKE 
'$alpha%' ORDER
BY last_name";
        }

        $result = pg_exec($db, $query);
        if(!$result) {
                echo "An error occured executing the query.\n";
                exit;
        }

        $numFields = pg_numfields($result);
        $numRows = pg_numrows($result);

        if($numRows > 0) {
                for ($rowCount=0; $rowCount < $numRows; $rowCount++) {
                        $row = pg_fetch_array($result, $rowCount);
                        if($rowCount % 2) {
                                print("<tr>\n");
                        } else {
                                print("<tr class=\"shade\">\n");
                        }
                        print("<td align=left valign=top width=200>");
                        print("<B>" . $row["last_name"] . ", " . $row["first_name"] .
"</B></td>\n");
                        print("<td align=left valign=top width=200>");
                        if($row["address1"]) {
                                print($row["address1"] . "<br>\n");
                        }
                        if($row["address2"]) {
                                print($row["address2"] . "<br>\n");
                        }
                        if($row["address3"]) {
                                print($row["address3"] . "<br>\n");
                        }
                        print($row["city"] . ", " . $row["province"]);
                        if($row["postal_code"]) {
                                print(" " . $row["postal_code"] . "<br>\n");
                        }
                        if($row["country"] != "Canada") {
                                print($row["country"] . "<br>\n");
                        }
                        if($row["email"]) {
                                print("<a href=\"mailto:"; . $row["email"] . "\">" . 
$row["email"] .
"</a>\n");
                        }
                        print("</td>\n</tr>\n");
                }
                if(!($numRows % 2)) {
                        print("<tr><td colspan=2 class=\"shade\">&nbsp;</td></tr>\n");
                }
        } else {
                print("<tr><td align=center valign=middle colspan=2>\n");
                print("<h2>Sorry</h2>\n");
                print("<B>There were no results that matched your query.</B>\n");
                print("<P>Please make another selection.</P>\n");
                print("</td></tr>\n");
        }

?>

- DR


Previous Comments:
------------------------------------------------------------------------

[2002-01-29 20:42:40] [EMAIL PROTECTED]

Could you take a look at web server error log? 
Do you have anything related? (segfault, etc)

Could you run iPlanet under gdb? (to see if it is exting or
segfaulting)

Do you quote connection string?
Do you get any error message from pg_connect? 
Do you have multiple libpq? (find / -name "libpq*")

Do you have the same problem with snapshot?
http://snaps.php.net/

Attach *complete* script even if it is a few lines next time.

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

[2002-01-29 13:56:28] [EMAIL PROTECTED]

When attempting to connecting to a remote database using
pg_connect(host=dbhost user=dbuser dbname=dbname), the operation
fails.

I can connect using psql from the command line or through a perl script
as any user. Running php as a CGI binary also works. However, when
running as an nsapi, the connection fails. A quick look using snoop
shows that the failed connection appears to be sending SYN/RST instead
of SYN/ACK (which is what is seen during a successful connection).

Here's my system details:
        OS: Solaris 2.8
        Web Server: iPlanet 4.1
        PHP version: php 4.1.1
        PHP configure options:
                ./configure --with-nsapi=/usr/local/iws41 \
                        --with-pgsql=/usr/local/pgsql \
                        --enable-libgcc
        PostgreSQL version: 7.0.3
        
For what it's worth, connections to a mysql database between the same
systems works without a hitch.

Any suggestions would be appreciated.



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



Edit this bug report at http://bugs.php.net/?id=15282&edit=1


-- 
PHP Development 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]

Reply via email to