An Odd PHP3/Apache Annoyance...
John Q. Public asks:
"I have done many checks with people I know personally, and on DejaNews and still haven't found a resolution to my problem. It appears, from reading posts on DejaNews, that I'm not the only one experiencing the pheonomenon. What happens is, while viewing certain PHP3 scripts under Netscape I get a "Connection Reset By Peer" message. Oddly enough, it doesn't happen under other browsers. We are using PHP 3.0.12, Apache 1.3.6 and are integrating it all with MySQL 3.22.23b on top of RedHat 6.0. I normally wouldn't think to turn to slashdot for all of my problems but it appears that I'm not the only one fighting this problem, perhaps someone out there knows whats going on." Any clues?
The problem was that PHP3 kept killing my apache process. Try it with only Red Hat's PHP3 and see if that helps.
PHP3 sometimes sends a null character (or EOF, i forget which). IE ignores null characters, while netscape thinks they mean that the end of the page, and stops processing. Check the faq for more, I think it has been fixed in later versions
Check if httpd processes die in some odd way.
Check the list of apache httpd processes and look if any of them disappeared when connection dropped. If they did, use strace -p on processes that are about to die to confirm that they died on some signal (repeat tests until process that you are strace'ing will get the request). Then if it indeed a crash use gdb (with "attach" command) to catch the moment of crash in the same way.
Or install fhttpd with php module enabled on some testing box, change php module configuration from local (that is set by default in root-fhttpd.conf but commented out) to remote (comment out the "tail" of php application definition fhttpd.conf, starting from /usr/local/sbin/php), restart fhttpd and run fhttpd php module manually, connecting it with fhttpd, entering password, etc. under gdb. If php will crash, gdb will catch it. If it won't, you still have gdb to figure out what happened.
Contrary to the popular belief, there indeed is no God.
We had this problem at linuxpower 10 months or so ago... the problem ended up being a few spurious mysql_connect rather than mysql_pconnect being used. Moral of the story: use mysql_pconnect() rather than mysql_connect().
But I digress. The problem mysteriously fixed itself after I upgraded to a newer kernel. I am currently running 2.2.10 without the problem surfacing. I had previously tried upgrading and downgrading every other piece of software (Apache, PHP, mod_ssl, etc) involved with no changes in behavior. I'm still not sure why the kernel was only doing it to these particular connections, but it got fixed *shrug*.
The site that is currently running with no problems (among a couple others) is Vantage Games. Which is currently running:
MySQL 3.22.23b
Apache/1.3.6 (Unix) PHP/3.0.11 mod_ssl/2.3.5 OpenSSL/0.9.3a
And the kernel is self compiled 2.2.10 SMP
---
Don Rude - AKA - RudeDude
RudeDude
Perl/Linux/PHP hacker
"Connection reset by peer" is a rather strange message. Check your error log. If it says something about receiving signal 11 (sigsegv) you should follow these instructions and post a PHP bug report.
Also make sure to always use the latest available release. 3.0.12 is already very stable, future releases of the php3 tree will only feature bug fixes.
--
OS lover
OS lover