negative_creep Posted February 3, 2009 Share Posted February 3, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/143641-php-infinite-loops/ Share on other sites More sharing options...
corbin Posted February 4, 2009 Share Posted February 4, 2009 Hrmmm max_execution_time should stop that.... You set it in php.ini right? Also, are they over riding it in their PHP file? Quote Link to comment https://forums.phpfreaks.com/topic/143641-php-infinite-loops/#findComment-754067 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.