logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: RLimitMEM & RLimitCPU with Virtual Hosts and PHP
Author
mmcdermo



Joined: 03 Nov 2006
Posts: 3

PostPosted: Fri 03 Nov '06 21:57    Post subject: RLimitMEM & RLimitCPU with Virtual Hosts and PHP Reply with quote

Hello there!
I'm working towards an apache setup where I have several virtual hosts running a PHP application. If I set RLimitMEM and RLimitCPU for each virtual host, would this limit CPU and Memory on the processing of a PHP script run by one of the virtual hosts? I'm confused about what happens when a PHP script is executed; In the apache docs for RLimitCPU, they note

Apache Docs wrote:
This applies to processes forked off from Apache children servicing requests, not the Apache children themselves


So, could this be used to limit CPU&Memory used for a PHP script executed from within a Virtual Host, or are all php scripts executed inside of one process ?

Thank you for your valuable time,
~Morgan McDermott
Back to top
Brian



Joined: 21 Oct 2005
Posts: 209
Location: Puyallup, WA USA

PostPosted: Fri 03 Nov '06 22:06    Post subject: Reply with quote

I did a quick google search at:

http://www.google.com/search?q=RLimitMEM+%2Bwindows&start=0

and it appears after reading a few of the results that this is not going to benefit you in a Windows Environment.

For me, when I use PHP in a SAPI execution environment I do set in the defualt PHP.INI file the basic generic one size fit's all standards for memory use, basedir (/www/), time of execution and so on. Then you can apply this to all vhosts and make adjustments in the VHOST containers as needed.

If you use CGI, it must all be contained wtihin the PHP.INI file.

But because of how Windows and Apache work (quite different from Linux, which others can surely better explain than I can), you will need to control this from the PHP settings.

Are you using CGI/FCGI or the Apache Modules (SAPI)?
Back to top
mmcdermo



Joined: 03 Nov 2006
Posts: 3

PostPosted: Fri 03 Nov '06 22:09    Post subject: Reply with quote

I haven't decided which to use yet, as I'm not familiar with the restrictions of each. Which would you recommend?
Back to top
Brian



Joined: 21 Oct 2005
Posts: 209
Location: Puyallup, WA USA

PostPosted: Fri 03 Nov '06 23:02    Post subject: Reply with quote

If you are running a single domain, or domains that you manage and have complete control in a PHP environment, then personally I'd most likely go with FCGI. It's fast, nearly or as fast as SAPI and its rock solid stable.

SAPI (Apache Module) is very flexible for environments that need differing PHP settings for each vhost or even directory and location. I have about 550 vhosts, and I can set up PHP for each completely different. Of course this also puts a burden on the server, and it needs a lot more ram and horsepower as you ask it to do more.

So if you can use FCGI for your needs, it is the way to go, uses far less ram, is very stable, is very fast, and is very easy to set up (for the most part). Just remember that if you use FCGI/CGI then you cannot control anything for each VHOST, Location, or Directory as you can with SAPI connector, all vhosts use the same PHP.INI settings.
Back to top
mmcdermo



Joined: 03 Nov 2006
Posts: 3

PostPosted: Sat 04 Nov '06 0:42    Post subject: Reply with quote

Thank you for your detailed and thorough reply! With this new information, it looks like I'll have to do more testing to determine whether limiting the resources a specific Virtual Host's PHP scripts would use is more important than having more resources to allocate.

Thanks again for your speed and the quality of information, Brian. I'm sure I'll come back to these forums if I have any more Apache-related problems Smile.
Back to top
Brian



Joined: 21 Oct 2005
Posts: 209
Location: Puyallup, WA USA

PostPosted: Sat 04 Nov '06 5:55    Post subject: Reply with quote

mmcdermo wrote:
I'm sure I'll come back to these forums if I have any more Apache-related problems


What would be really great is if you came back not only when you have a problem with setting something up but also to maybe help another person with a problem they have.

Best of luck to you of course : )
Back to top


Reply to topic   Topic: RLimitMEM & RLimitCPU with Virtual Hosts and PHP View previous topic :: View next topic
Post new topic   Forum Index -> Apache