Jump to content

Recommended Posts

Hi!

 

We have a SLES 10 web server with Apache 2.2.0 and PHP 5.1.2. The server hosts around 50 web sites (virtual hosts). I've noticed a strange problem. One of our clients apparently has an infinite loop in PHP code. It causes new apache processes to be opened, and they never exit. When the number of processes hits the limit... the apache hangs, and 50 websites are down.

 

I've tried to lower max_execution_time in php.ini with no success. The error_log states "PHP Fatal Error: Maximum execution time of 10 seconds exceeded", but the process keeps on and never ends.

 

I've also experimented with infinite loops and here is a code that can replicate the problem:

 

<?php

  echo "<html><body>Starting...<br/>\n";

  for($i = 0; $i > -1; $i++)

  {

    echo "$i ";

    flush();

  }

  echo "End.</body></html>\n";

?>

 

The runaway processes clearly show on server-status page (apache module status with ExtendedInfo on). The process still shows there even after i close the browser that called the infinite PHP file!

 

Does anyone have any idea how to prevent PHP/Apache runaway processes?

 

Thanks in advance.

 

Vladimir.

 

Link to comment
https://forums.phpfreaks.com/topic/143641-php-infinite-loops/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.