From:             [EMAIL PROTECTED]
Operating system: Debian
PHP version:      4.0.6
PHP Bug Type:     Reproducible crash
Bug description:  PHP fsockopen() kills Apache.

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 bug report at: http://bugs.php.net/?id=14356&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to