0

I use Ubuntu 14.04.3 LTS on my server and run php5-fpm. I need to send a HTTP2 request via curl in php.

I used this tutorial to install curl/libcurl: https://blog.cloudflare.com/tools-for-debugging-testing-and-using-http-2/

Somehow in terminal if I run 'curl --http2 https://....' everything works fine.

But if I try it in PHP nothing works. Also the php-info doesn't show the http2 support.

Maybe someone can help, thanks!

Tobias
  • 128
  • 3

1 Answers1

0

Your PHP is most likely linked to the system default libcurl.so, which does not support HTTP/2.

You need to find a PHP package for your system that is linked to use libcurl.so that supports HTTP/2.

Tero Kilkanen
  • 36,796
  • 3
  • 41
  • 63
  • And how can I do it? – Tobias Nov 02 '16 at 20:01
  • Unfortunately I don't know if there is such a package available. If not, then you need to compile your own build of PHP 5.6 and link it with the newer Curl. https://www.howtoforge.com/how-to-build-php-5.6-fpm-fastcgi-with-zend-opcache-and-apcu-for-ispconfig-3-on-debian-7-wheezy is one guide telling how to compile PHP from sources. You might need to adapt something to make it work properly. – Tero Kilkanen Nov 02 '16 at 20:09
  • Mh, and there is no other way? sudo apt-get install php-curl does not do the trick...? – Tobias Nov 02 '16 at 22:12
  • Nope, unless you can find a repository that explicitly has the `libcurl` version needed and the `php-curl` package that uses that exact `libcurl` version. – Tero Kilkanen Nov 02 '16 at 22:17