JacobPerkins

Well-Known Member
May 2, 2014
617
97
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

In 2.4.26 I changed the (undocumented) default from 1 to 4 h2 workers, which brought us to the issue I linked. The easy fix is 'H2MaxWorkers 1' in the config and you have the pre-2.4.26 behaviour.

Regardless of the discussion if the change in 2.4.26 was reasonable or not: it is not possible to map the prefork single-thread requirement on to HTTP/2. Not going to work. One long running request, one websocket opened, and your browser will stall.

This is not a bug, it is the collision of the processing models.
Please let us know if there are any questions.
 
  • Like
Reactions: Infopro

Zoltan Szabo

Active Member
Jul 13, 2017
41
8
8
Hungary
cPanel Access Level
Root Administrator
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
 

Reado

Well-Known Member
Sep 8, 2009
227
8
68
United Kingdom
cPanel Access Level
Root Administrator
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.
 

Zoltan Szabo

Active Member
Jul 13, 2017
41
8
8
Hungary
cPanel Access Level
Root Administrator
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
 

Attachments

Reado

Well-Known Member
Sep 8, 2009
227
8
68
United Kingdom
cPanel Access Level
Root Administrator
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.
 

Zoltan Szabo

Active Member
Jul 13, 2017
41
8
8
Hungary
cPanel Access Level
Root Administrator
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 ?
 

Attachments

morrow95

Well-Known Member
Oct 8, 2006
163
8
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.
 

Reado

Well-Known Member
Sep 8, 2009
227
8
68
United Kingdom
cPanel Access Level
Root Administrator
@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.
 

Zoltan Szabo

Active Member
Jul 13, 2017
41
8
8
Hungary
cPanel Access Level
Root Administrator
@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
 

Zoltan Szabo

Active Member
Jul 13, 2017
41
8
8
Hungary
cPanel Access Level
Root Administrator
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
 

Zoltan Szabo

Active Member
Jul 13, 2017
41
8
8
Hungary
cPanel Access Level
Root Administrator
@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
 

linux4me2

Well-Known Member
Aug 21, 2015
259
78
78
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.
 

Zoltan Szabo

Active Member
Jul 13, 2017
41
8
8
Hungary
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.
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
 

morrow95

Well-Known Member
Oct 8, 2006
163
8
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.
 

morrow95

Well-Known Member
Oct 8, 2006
163
8
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.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,225
463
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:

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

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:

Change Your Apache MPM

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

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:

Code:
httpd -v
Thank you.
 

linux4me2

Well-Known Member
Aug 21, 2015
259
78
78
USA
cPanel Access Level
Root Administrator
300 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.
 
Last edited: