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.

Prefork and HTTP2

Discussion in 'EasyApache' started by cPJacob, Jul 19, 2017.

Tags:
  1. cPJacob

    cPJacob cPanel Product Owner
    Staff Member

    Joined:
    May 2, 2014
    Messages:
    599
    Likes Received:
    90
    Trophy Points:
    103
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Howdy,

    The Apache developers, as of Apache 2.4.27, have disabled HTTP2 when using the prefork MPM. A detailed explanation is below, or located at:

    Pony Mail!
    mod_http2(v1.10.6) causes segmentation fault · Issue #142 · icing/mod_h2 · GitHub

    Please let us know if there are any questions.
     
    Infopro likes this.
  2. Reado

    Reado Well-Known Member

    Joined:
    Sep 8, 2009
    Messages:
    184
    Likes Received:
    7
    Trophy Points:
    68
    Location:
    United Kingdom
    cPanel Access Level:
    DataCenter Provider
    This was actually made publically available in the CHANGES file under the 2.4 branch over 2 weeks ago:

    [Apache-SVN] Revision 1800774

    How did you miss this one and not address or announce a lot sooner?
     
  3. Zoltan Szabo

    Zoltan Szabo Member

    Joined:
    Jul 13, 2017
    Messages:
    18
    Likes Received:
    4
    Trophy Points:
    3
    Location:
    Hungary
    cPanel Access Level:
    Root Administrator
    Hello Jacob,

    1st My question is that setting "H2MaxWorkers" to 1 is a proper solution?
    2nd Where to set the value for H2MaxWorkers? I looked in httpd.conf but didnt find it there, i guess h2 has a seperate config file

    Please advice
    Kind Regards,
    Z
     
  4. UHLHosting

    UHLHosting Well-Known Member

    Joined:
    Sep 26, 2014
    Messages:
    57
    Likes Received:
    4
    Trophy Points:
    8
    Location:
    Bratislava
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    Anyone has any experiences with this issue? and what is a better replacement for Apache Prefwork? Some workaround this would be great to have in place.


    Best,
    Cosmin
     
  5. Reado

    Reado Well-Known Member

    Joined:
    Sep 8, 2009
    Messages:
    184
    Likes Received:
    7
    Trophy Points:
    68
    Location:
    United Kingdom
    cPanel Access Level:
    DataCenter Provider
    I switched all our sites to MPM:Event about 2 weeks ago in preparation for this release, while enabling PHP-FPM as well. Performance is even better compared to MPM:Prefork and MPM:Event works with HTTP/2.
     
  6. Zoltan Szabo

    Zoltan Szabo Member

    Joined:
    Jul 13, 2017
    Messages:
    18
    Likes Received:
    4
    Trophy Points:
    3
    Location:
    Hungary
    cPanel Access Level:
    Root Administrator
    Hello Reado

    I have little understanding on MPM packages, i just used what came default with Apache and that was Prefork.
    Are you saying that a single uninstall of mod_mpm_prefork and install of mod_mpm_event will solve the issue ?

    As such can we do this safely in WHM, just by switching one on and onther off and save ?
    Apache should retrart and haply ever after right ?

    Bye,
    Z
     

    Attached Files:

  7. Reado

    Reado Well-Known Member

    Joined:
    Sep 8, 2009
    Messages:
    184
    Likes Received:
    7
    Trophy Points:
    68
    Location:
    United Kingdom
    cPanel Access Level:
    DataCenter Provider
    Yes, by selecting MPM:Event (causes EA4 to automatically disable MPM:Prefork and DSO), I was able to use HTTP/2 with Apache 2.4.27.

    I used this article before making my choice, which sold it for me.

    I have always used MPM:Prefork and was sceptical at first about using another MPM. After switching to MPM:Event and enabling PHP-FPM, I had to change a few permissions since switching away from MPM:Prefork also disables PHP DSO, and so the PHP process now runs under the user account. In my case, some folders had to be set using chown to make things work properly, but that's all.

    Everything is now working great with Apache 2.4.27 and HTTP/2.
     
  8. Zoltan Szabo

    Zoltan Szabo Member

    Joined:
    Jul 13, 2017
    Messages:
    18
    Likes Received:
    4
    Trophy Points:
    3
    Location:
    Hungary
    cPanel Access Level:
    Root Administrator
    Hello Reado,

    I have read your link and the Apache documentation. As MPM pick depends on server and I have a 4 thread x64 VPS this seems to be a proper solution for me.
    I also managed to understand that only one MPM at a time but one should present. So its a single shift from one to another.

    Indeed what makes me worry is you mentioned MPM_event disable PHP DSO, and you moved to the PHP-FPM package.
    Now I use suPHP as a PHP handler. Will suPHP be disabled or it works woth MPM event ?

    In a nutshell will I have PHP and all my sites working after changing to MPM_event ?
     

    Attached Files:

  9. morrow95

    morrow95 Well-Known Member

    Joined:
    Oct 8, 2006
    Messages:
    104
    Likes Received:
    2
    Trophy Points:
    168
    I'm not following this. I have :

    mod_mpm_prefork 2.4.27-1.1.1.cpanel

    along with mod_http2, suphp, and suexec installed and have not noticed any problems. I added mod_http2 pretty much as soon as it was available in EA4 and checked the headers after installing - it shows the h2 protocol being used.

    Are you saying it will only temporarily work until the next Apache update or what? Like I said, I don't see any issues right now.
     
  10. Reado

    Reado Well-Known Member

    Joined:
    Sep 8, 2009
    Messages:
    184
    Likes Received:
    7
    Trophy Points:
    68
    Location:
    United Kingdom
    cPanel Access Level:
    DataCenter Provider
    @Zoltan Szabo, PHP-FPM is my choice, because I've read lots of good things about it and I have the hardware resources for it. I'm also only running a single PHP version since I use cPanel just to administer the server, not for reselling purposes. If I were you, I'd speak to cPanel for clarification as to what solution is best for your circumstances.
     
  11. Zoltan Szabo

    Zoltan Szabo Member

    Joined:
    Jul 13, 2017
    Messages:
    18
    Likes Received:
    4
    Trophy Points:
    3
    Location:
    Hungary
    cPanel Access Level:
    Root Administrator
    I was and still afraid to move to FPM when I first read this Choosing the best PHP handler - InMotion Hosting
    I have very little RAM only 1G for server and few sites but CPU is fair enough so I rather stress the CPU

    So far I found no info in moving to MPM_event keeps suPHP alive! When i find i will come back and edit.

    Thanks for info Reado
     
  12. Zoltan Szabo

    Zoltan Szabo Member

    Joined:
    Jul 13, 2017
    Messages:
    18
    Likes Received:
    4
    Trophy Points:
    3
    Location:
    Hungary
    cPanel Access Level:
    Root Administrator

    Hello cPJacob,

    As from last Apache refresh MPM prefork doesnt work with h2, I like to ask what is the best solutuin to get over this?

    Some suggested to move to MPM event which makes sense on my VPS but I am afraid it will disable suPHP just how it disables DSO

    So my question is: Is moving to MPM event a proper solution and does it keep suPHP alive?

    Thanks for help, even in advance
    Z
     
  13. Zoltan Szabo

    Zoltan Szabo Member

    Joined:
    Jul 13, 2017
    Messages:
    18
    Likes Received:
    4
    Trophy Points:
    3
    Location:
    Hungary
    cPanel Access Level:
    Root Administrator
    Ok it was hard to find any info over MPM event and suPHP but earlier mentioned article Choosing a PHP Handler – Liquid Web Knowledge Base
    said that "SuPHP works with any Apache MPM, though, and both the Worker and Event MPMs can help to improve resource utilization"

    So I was brave and shifted to MPM event in WHM. Just a few sec and server live with new MPM php works as expected.
    HTTP2 also works

    Sos from my side its SOLVED
     
  14. linux4me2

    linux4me2 Well-Known Member

    Joined:
    Aug 21, 2015
    Messages:
    149
    Likes Received:
    34
    Trophy Points:
    28
    Location:
    USA
    cPanel Access Level:
    Root Administrator
    After changing MPMs, you should check in Software -> MultiPHP Manager -> PHP Handlers and make sure you have selected the handler you want to use for each version of PHP you are running. When I switched to MPM Event, it defaulted to CGI, and I wanted to use suPHP.
     
  15. Zoltan Szabo

    Zoltan Szabo Member

    Joined:
    Jul 13, 2017
    Messages:
    18
    Likes Received:
    4
    Trophy Points:
    3
    Location:
    Hungary
    cPanel Access Level:
    Root Administrator
    Thanks, indeed after the install this is what i checked first
    Nothing changed still suPHP (Thankfully)

    As I dont have mod_proxy_fcgi or anything needed for FPM installed it could only be nothing or suPHP (I guess)

    bye
    Z
     
  16. morrow95

    morrow95 Well-Known Member

    Joined:
    Oct 8, 2006
    Messages:
    104
    Likes Received:
    2
    Trophy Points:
    168
    For you guys who changed to event mpm - what are you using in your Home »Service Configuration »Apache Configuration »Global Configuration? You realize some of the settings here have totally different meaning than when using prefork right? I remember trying out mpm event in the past and found there was a lot of extra stuff I needed to do with include files to properly set the settings for mpm event basically because that page in WHM doesn't take into account what mpm you are using - it will always shows the same settings/values no matter which one you select.
     
  17. linux4me2

    linux4me2 Well-Known Member

    Joined:
    Aug 21, 2015
    Messages:
    149
    Likes Received:
    34
    Trophy Points:
    28
    Location:
    USA
    cPanel Access Level:
    Root Administrator
    I'm using the defaults except for max connections per child, which I have set to 300. (And I have Indexes unchecked, but that's not relevant.)
     
  18. morrow95

    morrow95 Well-Known Member

    Joined:
    Oct 8, 2006
    Messages:
    104
    Likes Received:
    2
    Trophy Points:
    168
    300 down from 10,000 I believe was the default? May I ask the reasoning behind that? I just looked again and things like server limit, connections per child, request workers, etc should more than likely be changed from what is given if using the event mpm. You just need to click on the 'info' links given next to each setting in WHM to see what Apache has to say and how the values are interpreted differently for each mpm - some settings aren't even shown and need to be added through use of an include or modifying the httpd.conf template.
     
  19. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,064
    Likes Received:
    1,288
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Configuring this value will allow mod_http2 to work with the Prefork MPM as it did in Apache version 2.4.26. However, this isn't recommended because your system is then vulnerable to issues like the one quoted in the first post:

    The recommended solution if you would like to continue using Mod_HTTP2 is to switch to the worker or event MPM:

    Multi-Processing Modules - MPMs - EasyApache 4 - cPanel Documentation

    The mod_http2 configuration file is located at:

    Code:
    /etc/apache2/conf.d/http2.conf
    Remember to restart Apache to enable any changes made in this file. More information about H2MaxWorkers option is available on the Apache documentation website:

    mod_http2 - Apache HTTP Server Version 2.4

    You can find general information and guidelines about the Worker and Event MPMs (these are the ones compatible with HTTP/2) at:

    Multi-Processing Modules - MPMs - EasyApache 4 - cPanel Documentation

    Yes, switching to the event or worker MPM will allow mod_http2 to function as expected. However, it's a good idea to first browse to "WHM >> MultiPHP Manager" to see which PHP handlers you are using and determine if they are compatible with the new MPM selection (e.g. The DSO handler requires the MPM Prefork Apache module). We document each PHP handler at:

    PHP Handlers - EasyApache 4 - cPanel Documentation

    Yes, that's correct. We also provide a guide on how to change the Apache MPM at:

    Change Your Apache MPM

    suPHP is compatible with both the worker and event MPMs. Here's a link to the suPHP section of our PHP Handlers document:

    suPHP Compatibility

    Apache 2.4.27 was published as part of the EasyApache 4 maintenance release yesterday. Is Apache updated to version 2.4.27 on your system? You can check with a command such as:

    Code:
    httpd -v
    Thank you.
     
    UHLHosting and Zoltan Szabo like this.
  20. linux4me2

    linux4me2 Well-Known Member

    Joined:
    Aug 21, 2015
    Messages:
    149
    Likes Received:
    34
    Trophy Points:
    28
    Location:
    USA
    cPanel Access Level:
    Root Administrator
    You can certainly ask, but I don't know the answer. That's how it was configured by my previous web host, I believe. I haven't ever changed it.

    I read the "more info" sections on some of the settings. We should probably start a separate thread about the correct configuration of Apache with Event MPM.
     
    #20 linux4me2, Jul 19, 2017
    Last edited: Jul 19, 2017
Loading...

Share This Page