The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

FastCGI with PHP and Apache

Discussion in 'EasyApache' started by Starcraftmazter, Aug 2, 2009.

  1. Starcraftmazter

    Starcraftmazter Well-Known Member

    Joined:
    May 5, 2006
    Messages:
    47
    Likes Received:
    0
    Trophy Points:
    6
    I'm trying to get fastcgi to work with php and apache manually (I don't want to affect the PHP which runs under apache normally, instead I want to install another version), however I'm having trouble getting the configuration right in httpd.conf

    Amongst the most confusing things are the instructions here:
    PHP | FastCGI -

    What is supposed to be under /export? This directory does not even exist on my file system, and I've never heard of it before.

    Also, would anyone care to share their httpd.conf if they are using fastcgi in a multi-user environment?

    Cheers
     
  2. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    FastCGI should only be used to load Perl based scripts on servers where PHP is running as a DSO (Apache module)
    or where PHP is running as a pure CGI / phpSuExec (Neither are recommended) without SuPHP.

    FastCGI SHOULD NOT should not be used if you are using SuPHP for your
    PHP installation on your server!

    The information on the FastCGI site is actually pretty old and doesn't take into account current PHP installations
    and most of what is written was actually written during the time between plain CGI mode and early phpSuExec
    was released which are both quite different from today's typical SuPHP installations which do not need FastCGI.

    In fact, running FastCGI along side SuPHP will actually SLOW down your server's performance as well as
    create a number of server compatibility and stability issues!

    If you are running PHP as an Apache module (DSO) then FastCGI won't have any effect on PHP and will just
    serve to help performance with Perl / CGI scripts running on your server.
     
    #2 Spiral, Aug 2, 2009
    Last edited: Aug 2, 2009
  3. Starcraftmazter

    Starcraftmazter Well-Known Member

    Joined:
    May 5, 2006
    Messages:
    47
    Likes Received:
    0
    Trophy Points:
    6
    Thanks for the tip!

    What would you recommend I use to run another version of PHP which does not interfere with the default php install which works as an apache module?

    Edit: I think you may have misunderstood my setup. I currently have PHP as an apache module, and I am not using suPHP. I am looking for a way to run another version of PHP alongside the version I am running as an apache module (and without affecting it), so as far as I understand, the only way to do this is to run it as a cgi module, and from what I heard, fastcgi is faster than cgi - which is why I chose it. But if you can suggest something better, feel free.

    Thanks!
     
    #3 Starcraftmazter, Aug 2, 2009
    Last edited: Aug 2, 2009
  4. anton_latvia

    anton_latvia Well-Known Member
    PartnerNOC

    Joined:
    May 11, 2004
    Messages:
    348
    Likes Received:
    3
    Trophy Points:
    18
    Location:
    Latvia
    cPanel Access Level:
    Root Administrator
    Spiral - what about apache 2.2 module fastcgid ? As far as I understand from the docs, apache should spawn fastcgi daemons for each user that is running PHP sites and should keep them running/processing PHP files under user privileges. This does sound very similar as in suPHP mode, but should eliminate time used for executing binary php for every php request. Executing separate PHP process in suPHP (CGI) mode creates high IO load.. I would appreciate your comments.

    Anton.
     
  5. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    Starcraftmazter, I am still a little baffled as to why you would want to run two versions of PHP? That part does not make any logical sense to me and introduces potential conflicts.

    Can you do that? Sure!

    Would I recommend it? No!

    Anton_Latvia, to answer your question .... No!

    It actually reduces overall system performance very slightly but measurable and doesn't give any acceleration to the execution of PHP scripts; This is primarily likely due to the fact that SuPHP is actually a DSO itself which in turn makes it's own internal calls to the PHP CGI Binary separate from the typical Apache CGI API structures in place as you would find for Perl scripts or phpSuExec.
     
  6. anton_latvia

    anton_latvia Well-Known Member
    PartnerNOC

    Joined:
    May 11, 2004
    Messages:
    348
    Likes Received:
    3
    Trophy Points:
    18
    Location:
    Latvia
    cPanel Access Level:
    Root Administrator
    Spiral, sorry for reasking. What do you compare with when saying:

    If FastCGId can descrease I/O load, that would mean something too - right now 25% is used by IO (measured by munin). I will be testing fastcgi this night. What worries me is - what ownership and permissions will uploaded files have and if I still will be able to allow customers change from one PHP version to another.

    Sorry, I haven't heard any real reason why cPanel and you do not recommend fastcgid module.

    Anton.
     
Loading...

Share This Page