Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 533371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:30:06+00:00 2026-05-13T09:30:06+00:00

I have basic idea about running PHP in different configurations like mod_php, cgi, FastCGI,

  • 0

I have basic idea about running PHP in different configurations like mod_php, cgi, FastCGI, etc.

In my findings and test I found FastCGI is slightly better. I like FastCGI’s support for SuEXEC most. Wait I do not want to get into benchmarking business here again. If you surf web, you will find people proving one way is faster than another in terms of number of requests handled per second. Well its good metrics but I am interested in different factors and here are my questions…

  1. Which method of running PHP consumes less memory?
  2. Also which method consumes memory nearly constant. I see with mod_php my servers memory usage fluctuating between 300MB and 800MB, every few seconds.
  3. But with FastCGI, first response from server comes very late. I see with FastCGI there is an initial delay per webpage request. Once first response from server arrives, other items like images, css, js loads pretty faster.
  4. Is it OK to run mix of both? I have 5 sites on dedicated server. Is it ok if I run few with mod_php and rest with FastCGI?
  5. I am sure that my server goes down mostly because of improper memory usage by mod_php. I checked all scripts. Is there any way to make sure memory consumption on server remains nearly constant?
  6. Does complexity of .htaccess affects memory usage significantly? If yes, can it be a single reason to make server run out of memory?
  7. Does apache MPM prefork/worker settings affect memory consumption? Do they affect mod_php and FastCGI mode equally?
  8. When I run “top” command, I see apache (httpd) consuming memory around 40MB. There are many instances of httpd running. Also in addition to that FastCGI forks some processes of similar size. What is normal memory size for httpd process?
  9. As I am running WordPress on all of our sites, which will be good way in that context?
  10. Does FastCGI/SuExec works fine with APC? Do I need to reconfigure APC to work with SuEXEC and FastCGI.

Please note, I am less interested in surviving against DIGG or traffic spikes. I want a way which can make server stable and predictable.

Sorry if I am confusing but I am really in mess. I have 512MB physical RAM, 400MB Swap and my server is running out of memory like crazy. Average memory requirement is around 350MB, it just memory usage spikes makes memory unavailable for few seconds and if few extra hits received in those few second window, apache crashed while mysql and all other fellas keep running fine.

Please help me out guys. I am not gonna buy more RAM or hardware. I am damn sure that problem is in my configuration. Sorry if I sound arrogant or ignorant.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:30:07+00:00Added an answer on May 13, 2026 at 9:30 am

    Which method of running PHP consumes less memory?

    I assume that per PHP-processed request they are more or less the same. But if you have mod_php loaded into apache serving images too, then I assume your memory footprint will be higher due to serving static files.

    Also which method consumes memory nearly constant. I see with mod_php my servers memory usage fluctuating between 300MB and 800MB, every few seconds.

    You can make both pretty constant. If you carefully set MaxClients, MinSpareServers and MaxSpareServers, you pretty much can tell how many processes are running. If you also set memory_limit within your PHP config, you can calculate how much memory you need.
    You can do the same for fcgi too, since you can decide how many processes are running.

    But with FastCGI, first response from server comes very late. I see with FastCGI there is an initial delay per webpage request. Once first response from server arrives, other items like images, css, js loads pretty faster.

    This doesn’t make sense. I am not sure why it happens in your case.

    Is it OK to run mix of both? I have 5 sites on dedicated server. Is it ok if I run few with mod_php and rest with FastCGI?

    I guess, but it will both be a nightmare to maintain and will probably be harder to configure for saving memory. Quite the contrary I believe.

    I am sure that my server goes down mostly because of improper memory usage by mod_php. I checked all scripts. Is there any way to make sure memory consumption on server remains nearly constant?

    Configure memory and processes as I outlined above, and keep monitoring.

    Does complexity of .htaccess affects memory usage significantly? If yes, can it be a single reason to make server run out of memory?

    I don’t think so. per-directory .htaccess can slow things down, but unless there is some serious bug in Apache, it should not cause mass memory consumption.

    Does apache MPM prefork/worker settings affect memory consumption? Do they affect mod_php and FastCGI mode equally?

    It might, but I recommend to stay away from worker, as PHP is mostly not thread safe.

    When I run “top” command, I see apache (httpd) consuming memory around 40MB. There are many instances of httpd running. Also in addition to that FastCGI forks some processes of similar size. What is normal memory size for httpd process?

    30MB is the min. The upper limit depends on your application (I have seen cases where it was ~1GB)

    As I am running WordPress on all of our sites, which will be good way in that context?

    It is probably a matter of taste. I have recently moved away from apache towards nginx+fastcgi. it takes a bit of time to get used to, but it does work well. No problems whatsoever with wordpress (even not with supercache, which is rather involved in terms of web server).

    Does FastCGI/SuExec works fine with APC? Do I need to reconfigure APC to work with SuEXEC and FastCGI.

    I am not using suExec, but fastcgi works well with APC. No need to configure anything.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 379k
  • Answers 379k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The simplest solution if you have PC's and DB server… May 14, 2026 at 9:25 pm
  • Editorial Team
    Editorial Team added an answer I usually use: position: absolute; height: 100%; And on the… May 14, 2026 at 9:25 pm
  • Editorial Team
    Editorial Team added an answer It depends on if you want to change the sliders… May 14, 2026 at 9:25 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.