cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: HTTP2 support in libcurl3 for Ubuntu 14.04 and PHP7

From: Ray Satiro via curl-library <curl-library_at_cool.haxx.se>
Date: Tue, 13 Sep 2016 18:35:13 -0400

On 9/9/2016 11:59 AM, Scott Moser wrote:
> I need a version of libcurl3 that will enable me to initiate HTTP2 sessions with Apple’s APNS service from within my PHP7 app running on Ubuntu 14.04.

On 9/10/2016 9:39 AM, Scott Moser wrote:
> Do you know of anyone providing a libcurl build with HTTP2 enabled for a more recent version of Ubuntu? I’ve searched and can’t seem to find one. Maybe my search skills are lacking:-)
>
> I’ve tried compiling my own version (limits experience doing this) and have run into issues re: missing pkg-config for nghttp2, instructions include python bindings which I don’t need, etc.

I am not aware of a package that has it. I build curl manually in Ubuntu
14 and 16 LTS with nghttp2 and install it in /usr/local. My notes are at
https://gist.github.com/jay/d88d74b6807544387a6c you can copy and paste
the sections. I don't have an automated script for it, though I probably
should. I do openssl then nghttp2 then curl. Note if you haven't yet set
up gpg you'll need to use a keyserver eg gpg --keyserver keys.gnupg.net

cat << EOF > a.c
#include <curl/curl.h>
int main() {
printf("%s\n", curl_version());
return 0;
}
EOF
gcc a.c `curl-config --libs --cflags`
./a.out
# Should show your just installed version
libcurl/7.50.2 OpenSSL/1.0.2h zlib/1.2.8 libidn/1.32 nghttp2/1.14.1
librtmp/2.3

In 16.04 LTS you can then just do sudo apt-get install php php-curl and
you'll also have to put this in your php
curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);

In 14.04 LTS I'm not running PHP7 but I'd guess you have to rebuild and
link to the right libcurl? I'm not sure. Let me know what you end up doing.

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-09-14