Re: Mod_Layout + PHP + a very large Ouput =>Server unusable (Memory usage to high)

"Stefan" <[email protected]> Mon, 21 Jul 2008 14:24:16 +0200
Newsgroups gmane.comp.apache.mod-layout
Message-ID <270CDAFD6C2542E5857F3CC556BAB650@MedienPC>
Thanks,
I will try it with the rlimit*.

But its not a PHP mistake. I have memory_limit set to 13MB but Apache uses 
over 750MB. Few seconds after you request such a script the memory is full. 
If i run Apache without mod_layout all works fine.

I think, the problem is, that he buffers to much.

But tanks for your answer. I will try it out.

Greets
Stefan Grubisic

----- Original Message ----- 
From: "Alan Dennis Wright" <[email protected]>
To: <[email protected]>
Sent: Monday, July 21, 2008 10:01 AM
Subject: Re: [Mod_layout] Mod_Layout + PHP + a very large Ouput =>Server 
unusable (Memory usage to high)


> Have you considered trying 'rlimitcpu' or 'rlimitmem' within you apache 
> configuration?
>
> I don't know if it'll work but its worth a try if it is apache that's 
> causing the problem.  If php is inadvertantly causing the block then you'd 
> need to adjust the php limits within php.ini 
> (max_execution_time,max_input_time,memory_limit).
>
> Rgds
>
> Alan Wright
> FEHS Technician
>
> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Stefan
> Sent: 20 July 2008 18:19
> To: [email protected]; Alan Dennis Wright
> Subject: [Mod_layout] Mod_Layout + PHP + a very large Ouput => Server 
> unusable (Memory usage to high)
>
> Hi,
>
> My problem is the same like here: 
> http://lists.tangent.org/pipermail/mod_layout/2008-February/002364.html
>
> Can someone tell me, how to fix it? A little Script which kills Apache 
> processes that need to much memory doesn't really work. When u have a PHP 
> script, which runs in an endless loop and produces much conent (e.g. 
> Errors) the Apache will "eat" all the memory (inc. swap) which makes your 
> server nearly to stop working. If you have a bit luck you can login over 
> ssh (5-10 Minutes till the loginscreen appeared) or you have to call the 
> computer center and ask them to restart your server.
>
> A script which causes such a usage could look like this (We have a 
> Freehoster and there are always people that make such mistakes and we had 
> it 3 times now :( )
>
> <?php
>
> $fh = fopen('test.txt', 'r');
>
> while(!feof($fh))
>    fgets($fh);
>
> fclose($fh);
>
> ?>
>
> If the file doesn't exists in addition to the wrong ! infront of feof() 
> you will get an endless loop with uncountable error-messages ==> Apache 
> needs all memory without ANY replace done by the Module.
>
>
> Sorry for my bad english. I hope you understand, what i try to say and i 
> hope, that it will and can be fixed.
>
> Greets
> Stefan Grubisic
> _______________________________________________
> Mod_layout mailing list
> [email protected]
> http://lists.tangent.org/mailman/listinfo/mod_layout