Upgrade CURL to support HTTP2

Hi all,

I am running CentOS 7 and I have upgraded to php7.2 but cannot make a post over http/2 because my version of curl is 7.29.0 which does not have the HTTP2 feature.

Can anyone help with how to upgrade curl, or reinstall it with that feature enabled?

Many thanks

Howdy,

Well, that’s a tricky problem you’re seeing there.

Essentially, the issue is that CentOS 7 does not support http2. That is, the version of curl that CentOS ships does not include http2 support.

There aren’t supported ways for upgrading that, they don’t provide a repo with newer packages.

So you’d either have to find a third party repo that provides the curl version you need, or you’d need to compile it yourself. And making it harder is that the only two repos that we recommend, SCL and EPEL, don’t appear to have a newer curl version.

Doing some Googling, there do appear to be instructions here for manually compiling curl:

http://mor-pah.net/2017/06/21/installing-curl-with-http2-support-on-centos-7-self-contained/

Note that we haven’t tested that above, and if you manually install it, you’d need to make sure that you’re keeping it up to date so that you don’t run into any security issues.

The issue from there is how to get PHP to see that updated curl version, as it would be located in /usr/local/bin rather than /usr/bin. I’m not quite sure how to do that, but hopefully this is all enough to get you started.

Another option though would be to switch to a distro offering the packages that you need. That all depends on how invested you are in your current setup though :slight_smile:

-Eric

Eric, thanks for a full and complete response there. My end aim to set up a server for handling the delivery of Apple Push Notifications, and it is now a requirement that it be done over http/2. I am not averse to switching distro eventually, but it would have been nice to be able to set up my existing Virtualmin testing server to get things going first.

I think I’ll try the manual compilation and see if I can make it work. It’s only a testing server, so no real drama if something breaks.

A tempting alternative is to use a Mac (the latest OS has curl 7.54 which is fully http2 compliant, and php 7.2) but I don’t want to lose the benefits of Virtualmin, to which I have become very much accustomed.

This gurucodeit repo in combi with remi php does it to.
https://codeit.guru/en_US/2018/09/apache-httpd-2-4-35-brotli-alpn-http2-openssl-1-1-1-red-hat-centos-rhel/

But then your support from virtualmin and home dir and so on are…

Somewhere in blog forum there is a how to with virtualmin you have , as also for the remi edit the yum repolist according what you need and want to, if doing that wrong then i suppose you are in trouble when some update is ariving. :wink:

I advise only to “play” test first with a not production box, then you can decide afterwards yes or no and so on. ( the test must be done with also updating cycles of some of the php, apache virtualmin and so on to be sure that they don’t break things.)

They also use EPEL wich is as above mentioned ok.

REMI use forumsearch for some possible probs if not solved yet.