Extensive PostgreSQL queries in PHP scripts causing browser error? - Mailing list pgsql-general

From Charles Hornberger
Subject Extensive PostgreSQL queries in PHP scripts causing browser error?
Date
Msg-id 3.0.5.32.19990322114101.0355c6d0@tabloid.net
Whole thread Raw
List pgsql-general
Hello all,

I've recently begun getting some strange browser errors from PHP scripts that do heavy-duty DB work inserting data and
creatingtables in PostgreSQL (but not SELECTing data). 

One script creates databases for clients using a lengthy -- 459 lines -- SQL script file, and the other performs
insertsinto 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
generatea "The server returned an invalid or unrecognized response" error.  In testing with the DB-creation script,
commentingout the exec() call eliminates the browser error.  It can also be eliminated by backgrounding the process
likeso: 

  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
Compuserveto IE 4.01 to Navigator 4.04) and with Lynx on Linux, but crashes on my boss' Windows 95 machines (running IE
4.01and 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
beenupgraded 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
sourceof confusion? 

Can anyone give me pointers on how to troubleshoot this?  I suspect that the script is generating some output that's
somehowbeing sent back to the browser ... although I don't know why that would suddenly start happening after a month
ofworking 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
theINSERTs take about 3 seconds to complete.  The rest of our database access/modification scripts are must smaller and
executealmost 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
figureout exactly what's going wrong so that it doesn't surprise me again down the road. 

Thanks in advance for any help.

Charlie

pgsql-general by date:

Previous
From: Richi Plana
Date:
Subject: Re: [GENERAL] fork() bad
Next
From: "K.T."
Date:
Subject: Re: [GENERAL] fork() bad