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!


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.

  • And how can I do it? – Tobias Nov 2 '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. howtoforge.com/… is one guide telling how to compile PHP from sources. You might need to adapt something to make it work properly. – Tero Kilkanen Nov 2 '16 at 20:09
  • Mh, and there is no other way? sudo apt-get install php-curl does not do the trick...? – Tobias Nov 2 '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 2 '16 at 22:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.