Extensive PostgreSQL queries in PHP scripts causing browser error?

From: Charles Hornberger <hornberger(at)tabloid(dot)net>
To: pgsql-general(at)hub(dot)org
Subject: Extensive PostgreSQL queries in PHP scripts causing browser error?
Date: 1999-03-22 19:41:01
Message-ID: 3.0.5.32.19990322114101.0355c6d0@tabloid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 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

Browse pgsql-general by date

  From Date Subject
Next Message K.T. 1999-03-22 21:48:38 Re: [GENERAL] fork() bad
Previous Message Gerard Saraber 1999-03-22 18:03:35 Re: [GENERAL] fork() bad