The fact that the error is showing up in the browser and its not generated
by your scripts says its probably not a postgreSQL error. My guess is that
Apache is timing out the connection. Check Apache logs to see if there are
any errors there. Also you might try running the scripts at the command
line to see what exactly is returned. www.cyberspyder.com has a tool that
shows you exactly what the server is returning to the browser including
content headers.
-----Original Message-----
From: Charles Hornberger <hornberger@tabloid.net>
To: pgsql-general@hub.org <pgsql-general@hub.org>
Date: Monday, March 22, 1999 2:35 PM
Subject: [GENERAL] Extensive PostgreSQL queries in PHP scripts causing
browser error?
>Hello all,
>
>I've recently begun getting some strange browser errors from PHP scripts
that do heavy-duty DB work inserting data and creating tables in PostgreSQL
(but not SELECTing data).
>
>One script creates databases for clients using a lengthy -- 459 lines --
SQL script file, and the other performs inserts into about a dozen different
tables. The former uses a call to exec() like so
'exec("/usr/local/pgsql/bin/psql -d $dbname < /web/pfps/sql/DBsetup.sql");'.
The latter does its work with calls to pg_exec().
>
>What happens is that in some versions of IE (versions 3 and 4, with SP1
applied) on some Windows machines, the scripts generate a "The server
returned an invalid or unrecognized response" error. In testing with the
DB-creation script, commenting out the exec() call eliminates the browser
error. It can also be eliminated by backgrounding the process like so:
>
> exec("/usr/local/pgsql/bin/psql -d $dbname < /web/pfps/sql/DBsetup.sql >>
/tmp/pgfoo 2>&1 &");
>
>The trouble appears to be browser/mnachine-dependent. We can reproduce it
on IE 3.01, IE 4.01 and IE 4.01/SP1 on some machines, but not on others. It
works fine on NT Server 4.0 and Windows 98 machines (using everything from
old Compuserve to IE 4.01 to Navigator 4.04) and with Lynx on Linux, but
crashes on my boss' Windows 95 machines (running IE 4.01 and IE 4.01/SP1)
and on my co-worker's Win95 machine running IE 3.01.
>
>The other strange part about the error is that it didn't exist two weeks
ago. In between now and then, the server has been upgraded from Linux
2.0.35 to 2.2.2. Our Apache/PHP installations haven't changed. The
installation is Apache/1.3.3 (Unix) PHP/3.0.6 mod_perl/1.17 (both compiled
in as modules.)
>
>Incidentally, I just noticed that phpinfo() still reports that the machine
running on Linux 2.0.35. Could that be the source of confusion?
>
>Can anyone give me pointers on how to troubleshoot this? I suspect that
the script is generating some output that's somehow being sent back to the
browser ... although I don't know why that would suddenly start happening
after a month of working flawlessly. And I don't know how to test to see
whether that's somehow the case.
>
>Or else there's some kind of timeout happening, maybe? The DB creation
script takes about 10 seconds to execute, and the INSERTs take about 3
seconds to complete. The rest of our database access/modification scripts
are must smaller and execute almost immediately --- and they don't generate
any errors.
>
>Of course I probably could hack my way around the problems with these two
scripts any number of ways, but I'd like to figure out exactly what's going
wrong so that it doesn't surprise me again down the road.
>
>Thanks in advance for any help.
>
>Charlie
>