Bug #14356 Updated: PHP fsockopen() kills Apache.

From: Date: Thu, 06 Dec 2001 01:24:59 +0000
Subject: Bug #14356 Updated: PHP fsockopen() kills Apache.
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-72707@lists.php.net to get a copy of this message
ID: 14356 Updated by: sniper Reported By: phil_3iem@hotmail.com Old Status: Open Status: Bogus Bug Type: Reproducible crash Operating System: Debian PHP Version: 4.0.6 New Comment: Yeah, you can do this with this code too: test.php: <?php include('test.php'); ?> It's not a bug. --Jani Previous Comments: ------------------------------------------------------------------------ [2001-12-05 19:46:05] phil_3iem@hotmail.com Using fsockopen() on a page to call itself causes the apache server to stop taking request. Wehn you look at ps there are as many httpd processes running as the server is allowed to run. (based on http.conf) Here is the code I created that takes down Apache. <code> <?php $fp = fsockopen ($HTTP_HOST, $SERVER_PORT, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)<br>\n"; } else { fputs ($fp, "GET $REQUEST_URI HTTP/1.0\r\nHost: $HTTP_HOST\r\n\r\n"); while (!feof($fp)) { echo fgets ($fp,128); } fclose ($fp); } ?> </code> The only way to bring Apache back is to kill the server and restart it. This can be a major problem with service providers that offer PHP since all of their sites will go down once this script is run. It seems like there is a problem with PHPs connect() call. The time out NEVER works and I have tried this on Debian and FreeBSD using the PHP module in Apache. pHil ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=14356&edit=1

« previous php.dev (#72707) next »