remicollet / remirepo

Issue tracker for

Home Page:https://rpms.remirepo.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Centos EL7: add HTTP2 support to curl

mnapoli opened this issue · comments

Hi,

I am not sure if this is a user error (me), or if HTTP2 is just not supported in the Centos EL7 packages.

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install yum-utils
yum update -y && yum upgrade -y
yum install php-cli

When I run php -i | grep http2 (or php -r "var_dump(get_defined_constants());" | grep CURL_HTTP) I can see that HTTP 2 support is not enabled.

Any idea on how to have HTTP2 work with curl? Do I need to install a separate package? Do I need to compile it separately? (not sure how since PHP is already compiled, it's not really a pecl package)


Extra information:

Original issue in our project: brefphp/aws-lambda-layers#42

I understand that EL7 is old and we shouldn't use that anymore, but this is the base for Amazon Linux 2 used by AWS Lambda, and we are unfortunately unable to change that.

Also when I install PHP in Amazon Linux 2 (Docker image: public.ecr.aws/lambda/provided:al2-x86_64), I see that the curl version is recent enough, and that libnghttp2 is correctly installed:

  • curl --version shows 7.79.1
  • libnghttp2 is installed with version 1.41.0
  • ldd shows that curl.so is correctly linked to libnghttp2, so "in theory" this should work correctly and I don't understand why it's not getting used:
ldd /lib64/php/modules/curl.so
	libcurl.so.4 => /lib64/libcurl.so.4 (0x0000004001a45000)
	libc.so.6 => /lib64/libc.so.6 (0x0000004001cdc000)
	libnghttp2.so.14 => /lib64/libnghttp2.so.14 (0x0000004002089000)
	...

Note that if I install the "official" PHP package (without using remirepo) then HTTP2 support is enabled in curl.

On EL-7 curl version is 7.29
On EL-8 curl version is 7.61
On EL-9 curl version is 7.76

HTTP2 support requires curl version 7.33

Again, sorry, but EL-7 is old, terribly old, and close to its EOL.

Not something I can fix easily, especially as curl is a critical library, used by system tools (e.g. yum)

Notice: version used at runtime won't change anything as such feature are detected at buildtime.

Thank you for the clarification, I understand.

Since this is, as you mention, a feature detected at buildtime, do you know if there is any way for me to enable it? (e.g. by compiling anything)

Or does that mean that the only solution is to recompile PHP entirely myself?

Yes need to rebuild PHP, and probably any extension using libcurl (curl, http, druid, molten, oauth, swoole...) and perhaps even (for consistency) all used libraries using libcurl...

What a bad news... 😰