Apache fastCGI vs Mod_php
Results 1 to 8 of 8

Thread: Apache fastCGI vs Mod_php

  1. #1
    Personally Humbled Person nrg_alpha's Avatar
    Join Date
    Mar 2008
    Location
    Canada
    Posts
    917

    Apache fastCGI vs Mod_php

    This is a little off topic.. but since we tend to test things locally (localhost) first prior to moving on to remote servers, I have questions regarding Apache setups.

    I was looking into what exactly fastCGI is and what mod_php is. The wikipedia results seems pretty descriptive.

    So if I understand this properly, fastCGI is an overhauled version of the orginal legacy CGI, and as a result is faster and can handle more webpage requests more easily.

    mod_php on the otherhand is an embedded interpreter, which can interface with the server more quickly (and handle more webpage requests as well?).

    According to the article, the downfall to mod_php is that it cannot be restarted independantly while fastCGI can. And as a result, many hosting providers prefer this. I wonder about a few things.

    • In what conditions would a hosting provider need to restart fastCGI? Is this for say PHP upgrades for instance? The article refers to things like 'facilitates per-application security policies — important for ISPs and web hosting companies.' Policies meaning?
    • Is there any benefits whatsoever of whether you install Apache on your local machine as fastCGI or going the route of module?
    • And tied into the previous question, as a result, does it make a difference whether your hosting provider runs Apache as fastCGI or as a mod?


    Cheers,

    NRG
    Last edited by nrg_alpha; 08-13-2008 at 11:43 PM.

  2. #2
    Super Geek bretticus's Avatar
    Join Date
    Apr 2002
    Location
    UT USA
    Posts
    1,576
    Well, my two cents....

    About the restarting issue. I've always been able to do an "apachectl restart" or an "/etc/init.d/apache reload" without causing any downtime on my server.

    As far as FastCGI, I've never used it (sorry.)
    When in doubt, read the manual: PHP MySQL
    For beginners: PHP 101 PHP + MySQL 101 Google
    Forum etiquette.: See FAQs (Typically found in sticky posts: top posts)
    Avoid asking questions like: "It's not working..." (Describe how it's not working!) "Do you know of a script..." (This is a forum for PHP developers.)

  3. #3
    Personally Humbled Person nrg_alpha's Avatar
    Join Date
    Mar 2008
    Location
    Canada
    Posts
    917
    Thanks for the response, Brett.

    I'm still at a loss. I was figuring with going the mod route, you couldn't restart without any downtime or other issues.

    Cheers,

    NRG

  4. #4
    Senior Member cahva's Avatar
    Join Date
    Jul 2002
    Location
    Finland
    Posts
    1,385
    Downtime is the same with mod_php and fastcgi when you restart the server.

    A big benefit for using php as cgi is that it is executed as the user, not www(or apache whatever). So bye bye for permission issues and chmodding write permissions to world Usually if you install software, they will work straight, thanks to php processes being run by the user, not webserver. Offcourse there can be software that dont work well with cgi but they are quite rare.

    We have ourselves servers with both and nowdays I myself like to do all my projects with cgi-one. . Speed is not an issue atleast with mod_fcgid that we use. Only downside can be the memory that cgi might consume a little more(but only a little).

  5. #5
    Personally Humbled Person nrg_alpha's Avatar
    Join Date
    Mar 2008
    Location
    Canada
    Posts
    917
    OK.. so I suppose then that it's ok either way (my apache on localhost is fastCGI). I was just wondering about any larger discrepencies (or differences in general) between the two that might lead one to lean towards one way or the other.. I'm not familiar with mod_fcgid, but I'll have a look into it.

    Thanks

    NRG

  6. #6
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,398
    Quote Originally Posted by cahva
    A big benefit for using php as cgi is that it is executed as the user
    But that benefit isn't gained only when using CGI; projects such as suPHP bring that same benefit to Apache modules as well.

  7. #7
    Senior Member cahva's Avatar
    Join Date
    Jul 2002
    Location
    Finland
    Posts
    1,385
    I might be wrong but even suPHP uses php-cgi version so its techically cgi as well

  8. #8
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,398
    Quote Originally Posted by cahva View Post
    I might be wrong but even suPHP uses php-cgi version so its techically cgi as well
    Alas, I was mistaken - it does indeed use CGI to call PHP.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •