By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,309 Members | 1,452 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,309 IT Pros & Developers. It's quick & easy.

endless loop script crashing apache

P: n/a
I'm using PHP 4.2.2 and Apache 2.0.4.0. A script running on a virtual
host had an endless loop in it that brought Apache to its knees. I have

max_execution_time=90
and memory_limit=32M

to handle larger file uploads and Gallery stuff (thumbnail processing)
but the script goes way past 90 seconds. Safe mode is off but the
script doesn't override it by using set_time_limit(). I have to restart
Apache to fix the problem. Apache Timeout is set to 300 seconds but
still goes way beyond that.

Any idea why the script might not be timing out?

Thanks...

Aug 15 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 15 Aug 2005 11:45:56 -0700, co*********@gmail.com wrote:
I'm using PHP 4.2.2 and Apache 2.0.4.0. A script running on a virtual
host had an endless loop in it that brought Apache to its knees. I have

max_execution_time=90
and memory_limit=32M

to handle larger file uploads and Gallery stuff (thumbnail processing)
but the script goes way past 90 seconds. Safe mode is off but the
script doesn't override it by using set_time_limit(). I have to restart
Apache to fix the problem. Apache Timeout is set to 300 seconds but
still goes way beyond that.

Any idea why the script might not be timing out?


http://uk.php.net/set-time-limit

" Note: The set_time_limit() function and the configuration directive
max_execution_time only affect the execution time of the script itself. Any
time spent on activity that happens outside the execution of the script such as
system calls using system(), stream operations, database queries, etc. is not
included when determining the maximum time that the script has been running."

Are you sure it "brought Apache to its knees"? Was it instead the machine it
that slowed down? What are you processing thumbnails with - GD (extension) or
an external process such as ImageMagick? If external you could use "nice" to
drop the priority of the process down.

It still shouldn't bring the rest of the system down on a Unix operating
system; the scheduler is there to make sure everything gets a resonable chance
to run even when the system is busy.

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Aug 15 '05 #2

P: n/a
Thanks for the reply... one of the scripts in question was poorly
written and endlessly looping through files on a non-existent file
resource handle. So I guess the file system would fall under the caveat
you quoted.

But still as you said it shouldn't bring the rest of the system down.
How is one to safeguard the server? I've checked out nice before but
didn't see any clear examples on how to properly use it.

Aug 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.