preventing system crashes

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I made a mistake in a script that completely froze my linux-based server:

I passed an array instead of a number to a function like:

function plg_ratingimg($rating)
global $plug_picrank;
for ($i=0;$i<$rating;$i++)
return $out;

where $plug_picrank is a simple HTML string.

Where is the weakness in the apache or php setup that something like this
can freeze the server?



Re: preventing system crashes

Quoted text here. Click to load it

Assuming this thing iterated a bazillion times, at least during the
PHP configured max script execution time, it busied the CPU to 100%
and also consumed a huge amount of memory.

Not sure if your PHP might be configured to have large amount of
memory available but a runaway loop like this can certainly cause a
server to THRASH, though probably not crash (as you have suggested).

Suspect the memory use put you over the acceptable paging limit for
this box.

Why don't you log into the machine interactively with telnet, SSH or
similar, run the defective PHP script and see what happens.  Does your
Linux panic and halt?  Or does the machine just go catatonic for a

Can you see the machine physically and check for excessibe disk
activity which would indicate rapid paging.

If the interactive session does continue to respond, top, vmstat and
various other diagnostic tools can help you learn what's really


Jerry Sievers   305 854-3001 (home)     WWW ECommerce Consultant
                305 321-1144 (mobile /

Re: preventing system crashes

Erwin Moller

Quoted text here. Click to load it

No it doesnt, strange enough.
FTP and SSH to the machine dont work anymore either "Connection refused"...


Site Timeline