Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

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.

Multiple php versions with fastcgi under EA4

Discussion in 'Workarounds and Optimization' started by Syneic, Aug 24, 2017.

  1. Syneic

    Syneic Member

    Joined:
    Mar 17, 2014
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    DataCenter Provider
    I've looked a bit into what i takes to run fastcgi with support for multiple php versions.
    This is quite easy to do through cli.
    As this needs the experimental repository, play at your own risk. ;)

    # Install easy apache 4 experimental repository to add fastcgi modules to easyapache4.

    yum install ea4-experimental

    # Run easyapache 4 through whm and add fastcgi module as well as the php versions you want.
    # Set fcgi as handler in php handlers under Multiphp manager in whm.

    # Set default php in post_virtualhost_global.conf as the last one set will be used.

    vi /usr/local/apache/conf/includes/post_virtualhost_global.conf

    ##
    <IfModule fcgid_module>
    FcgidWrapper /usr/local/cpanel/cgi-sys/ea-php56 .php
    FcgidWrapper /usr/local/cpanel/cgi-sys/ea-php56 .php5
    FcgidWrapper /usr/local/cpanel/cgi-sys/ea-php56 .phtml
    </IfModule>
    ##

    # Add FcgidWrapper for each php 7.x override.

    vi /usr/local/apache/conf/includes/post_virtualhost_global.conf

    ##
    <directory "/home/user/">
    FcgidWrapper /usr/local/cpanel/cgi-sys/ea-php70 .php
    </directory>
    ##

    And that is it, this user should now run under php 7.0 opposed to default 5.6.

    As for adding support for this through whm, it seems like all it should take is commenting out addhandler and the non default wrappers in php.conf and adding a:
    <IfModule fcgid_module>
    #FcgidWrapper /usr/local/cpanel/cgi-sys/ea-php56 .php
    FcgidWrapper /usr/local/cpanel/cgi-sys/ea-php70 .php
    </IfModule>
    Under each virtualhost, either by commenting out the one not in use or simply only show the one in use.

    Any thoughts ?

    Happy webserving :)
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,220
    Likes Received:
    1,376
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Keep in mind that while this workaround may allow it to function, it's unsupported and not guaranteed to work with all MultiPHP functionality. You can read more about this on the following feature request comment:

    EasyApache 4 mod_fcgid

    Is there any reason you prefer to use fcgid over PHP-FPM?

    Thank you.
     
  3. Syneic

    Syneic Member

    Joined:
    Mar 17, 2014
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    DataCenter Provider
    I've found it not to be as bulletproof as fastcgi unfortunately.
    Right now i got "FcgidMaxProcessesPerClass 1" set for each virtualhost, i can easy set the same in fpm with 1 child per pool.
    The problem comes when/if there is a huge number of requests against one pool, this for some reason also makes all other pools unresponsive and wont respond for hours or before fpm service is restarted.
    I've tried to change settings like max_request, process_idle_timeout, process_control_timeout, emergency_restart_interval but haven't found a satisfactory solution compared to fastcgi where only the one virtualhost get affected.
     
  4. Syneic

    Syneic Member

    Joined:
    Mar 17, 2014
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    DataCenter Provider
    I just tried to enable FPM on a fairly unoptimized wordpress installation on one of my servers and within 10 minutes the site bacame completly unresponsive, and the child was dead as in not serving anyone.
    It did not respond with 503 either, just waiting for response.
    When i restarted fpm service, then came the 503 and after a refresh everything worked as planned again.
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,220
    Likes Received:
    1,376
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Feel free to open a support ticket using the link in my signature if you'd like us to help troubleshoot the issue with PHP-FPM on your system.

    Thank you.
     
Loading...

Share This Page