Skip to main content

Prefork and HTTP2

Comments

37 comments

  • Reado
    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?
    0
  • Zoltan Szabo
    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.

    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
    0
  • UHLHosting
    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
    0
  • Reado
    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.
    0
  • Zoltan Szabo
    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.

    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
    0
  • Reado
    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.
    0
  • Zoltan Szabo
    I used this article before making my choice, which sold it for me. Everything is now working great with Apache 2.4.27 and HTTP/2.

    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 ?
    0
  • morrow95
    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.
    0
  • Reado
    @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.
    0
  • Zoltan Szabo
    @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 adminster 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.

    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
    0
  • Zoltan Szabo
    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.

    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
    0
  • Zoltan Szabo
    @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.

    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
    0
  • linux4me2
    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.
    0
  • Zoltan Szabo
    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.

    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
    0
  • morrow95
    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.
    0
  • linux4me2
    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.)
    0
  • morrow95
    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.
    0
  • cPanelMichael
    My question is that setting "H2MaxWorkers" to 1 is a proper solution?

    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: One long running request, one websocket opened, and your browser will stall.
    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
    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

    The mod_http2 configuration file is located at:
    /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
    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.

    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
    Are you saying that a single uninstall of mod_mpm_prefork and install of mod_mpm_event will solve the issue ?

    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
    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 ?

    Yes, that's correct. We also provide a guide on how to change the Apache MPM at:
    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.

    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:
    httpd -v
    Thank you.
    0
  • linux4me2
    down from 10,000 I believe was the default? May I ask the reasoning behind that?

    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.
    0
  • vlee
    I currently run Customized cPanel Default with only PHP 5.6 and PHP 7.0. I also saw that HTTP 2 does now work. So, I tried it with mod_mpm_event noticed that mod_ruid2 is disabled and I would have make permission changes on directories and files so websites can work properly. I like the performance mod_mpm_prefork gives me. I like the idea using HTTP 2 because it"s features are newer and better than the old way and my concerns are, I want to keep PHP 5.6 and PHP 7.0 because there are websites on my servers that do not work with PHP 7.0 because software vendors have not yet updated to use PHP 7 so they are stuck with PHP 5.6 for now. SuPHP is great but has performance issues and that is why I am using the Customized cPanel Default. Does mod_mpm_event gives better performance to SuPHP? OR Is there a better way of doing this be able to use HTTP 2?
    0
  • vacancy
    Mod event + suphp + php-fpm is a very compliant one. I use it smoothly on many servers. Prefork is cumbersome and an old mpm.
    0
  • vlee
    Mod event + suphp + php-fpm is a very compliant one. I use it smoothly on many servers. Prefork is cumbersome and an old mpm.

    That works But I found 2 other issues after doing setting things up Problem 1 Cannot use PHP Handler SuPHP at least on my end websites are broken and even checked permissions on files and folders which are correctly set for SuPHP. SuPHP is no biggie for me and PHP Handler CGI still works fine. Problem 2 Problem 2 is towards HTTP 2 with SSL When you run a SSL Server Test on the domain that is running HTTP 2 with an SSL it comes up with Server negotiated HTTP/2 with blacklisted suite Also browsers crash when you pull up a website HTTP 2 with SSL and you have refresh the page and website comes up fine. So this in mind the SSL Cipher Suite needs to be updated to work with HTTP 2 for those that using SSL's with HTTP 2.
    0
  • cPanelMichael
    Hi @vlee, I moved discussion of those topics into separate threads: HTTP 2 with SSL New Thread - suPHP broke websites Thank you.
    0
  • cPanelMichael
    Hello, To update, internal case EA-6600 is open to determine how to best handle HTTP2 compatibility with the Prefork MPM (i.e. if a conflict should occur when attempting to enable both of them in an EA4 profile). I'll monitor this case and update this thread with the outcome. Thank you.
    0
  • Hosted Power
    suphp with mpm_event is not a solution for us since opcache is incompatible. We also use mod_ruid2 for best performance... Only solution I see to quickly solve it without compatibility problems is to use nginx in front of apache2. Or trying php-fpm, but not sure how we could have correct user permissions (want to run php process as account user) and still having best possible performance.
    0
  • JacobPerkins
    Hello, We attempted to make Prefork and H2 compatible, but we were not very successful. As such, we are releasing a hard conflict today between the http2 and prefork packages. If you have both packages installed, you will not be able to update until you remove the http2 package. We've released an autofixer to assist with this. If you try to 'yum update' and you get conflict errors about http2 and prefork, you can run this script via ROOT on the command line / SSH:
    /scripts/autorepair ea4_address_mod_http2_conflict_with_mod_mpm_prefork
    0
  • msruby64
    I currently run MPM Prefork, DSO handler, and Opcache and would like to run HTTP/2. Are you still working on compatibility?
    0
  • cPanelMichael
    I currently run MPM Prefork, DSO handler, and Opcache and would like to run HTTP/2. Are you still working on compatibility?

    Prefork and HTTP2 are not compatible due to the technology behind how they are developed. This is related to Apache itself as opposed to cPanel. You can read more about this at: Pony Mail! mod_http2(v1.10.6) causes segmentation fault " Issue #142 " icing/mod_h2 " GitHub Thank you.
    0
  • grabyourhosting
    It says: Fixed in v1.10.7 Is it alright to use this with mod_ruid2 now? Shouldn't change the conflict and allow it now?
    0
  • cPanelMichael
    Hello @grabyourhosting, The "Fixed" status on the Apache bug report is not to indicate the two technologies have been made compatible:
    Prefork is not a threaded MPM. When used with h2, if the server was under stress, h2 may try to reference memory which was already unmapped. As of 2.4.27, Apache developers have set 'h2_workers' to 1, which essentially negates the effects h2 has. As a result, we created a conflict for h2 and Prefork.

    Thank you.
    0

Please sign in to leave a comment.