Greetings everyone,

I've been having a very frustrating problem over the past few months that
I've ***finally*** tracked down the "cause" of....

Any questions/comments/thoughts/ideas you can provide would be *greatly*

- IE, Opera, Lynx all report "page cannot be displayed" and/or "server
error" about "half the time"....
- NS has no problems at all.
- Apache error.log shows child (PID) seg faulted.

Problem post analysis:
- The Apache processes can accept and successfully serve one connection from
a client.  The next connection results in the Apache child process seg
faulting, the error getting logged in error.log, nothing gets reported in
access.log, and the Apache parent process respawns a new child.
- The newly spawned child will accept and serve one connection from a client
before also segfaulting.

I've eliminated every possibility I could think of while troubleshooting
this.  i.e. it's not SSL, it's not PHP itself, it's not Apache itself.  It's
the pg_pconnect() function.

Throughout my troubleshooting, I came upon it by accident, really, that I
discovered all my problems went away when I replaced the pg_pconnect()
function with the (almost deprecated according to the docs) pg_connect()

In troubleshooting this, I created a shell script that continuously loads
various pages from the site (using Lynx -dump -mime_header <url>), counts
the iterations, and bails as soon as a page fails to load.  Running this
against plain HTML files, PHP scripts (i.e. that simply echo something or
provide phpinfo(), etc.), over SSL or not all work just fine.  (>15,000
loads in each case without fault.)

As soon as I try accessing a PHP script that includes the pg_pconnect()
function, it dies almost immediately.  If I stop/start Apache right before
trying this, I'll get X successful loads (where X = Apache's 'StartServers'
property).   After that, I'll get a continuous mixture of successful and
failed loads from then on....

So, let me repeat here.... As soon as I switched from pg_pconnect() to
pg_connect(), everything worked perfectly after that.  (i.e. >15000 loads
without an error.)

More info:
- My platform is up-to-date Debian GNU/Linux (sid) (Apache 1.3.23, PHP
4.1.1, PostgreSQL 7.1.3, etc.)
- As above, this is *not* browser specific.  (Found a *lot* of google hits
with people having problems with IE and SSL and seg faults, etc.  Completely
- Note from above, though, that NS is unaffected by this problem.  It
*never* has a problem.  My assumption is that NS will simply silently retry
(several times) if the connection fails for some reason, until it does get a
valid response from the server....   (Kudos!!!  ;-)

So, any thoughts?  Comments?  Suggestions?

Have I found a bug in pg_pconnect()?   How can I provide more info to track
this down further?

Best regards,
Kevin Traas
Chief Information Officer, Co-founder
Merilus, Inc.     ---===  ===---

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to