close

[Solved] PHP Curl – Received HTTP/0.9 when not allowed

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error PHP Curl – Received HTTP/0.9 when not allowed in php. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How PHP Curl – Received HTTP/0.9 when not allowed Error Occurs?

Today I get the following error PHP Curl – Received HTTP/0.9 when not allowed in php.

How To Solve PHP Curl – Received HTTP/0.9 when not allowed Error ?

  1. How To Solve PHP Curl – Received HTTP/0.9 when not allowed Error ?

    To Solve PHP Curl – Received HTTP/0.9 when not allowed Error If you dont find nghttp2/{version} you need to compile curl again with nghttp2.

  2. PHP Curl – Received HTTP/0.9 when not allowed

    To Solve PHP Curl – Received HTTP/0.9 when not allowed Error If you dont find nghttp2/{version} you need to compile curl again with nghttp2.

Solution 1

This can also happen when the server is a grpc server. When curl is run against a grpc server or other non-HTTP server that doesn’t respond with a valid HTTP status line that curl expects, curl will print the “Received HTTP/0.9 when not allowed”.

It might be better if curl printed something like “unknown protocol” rather than assuming it is 0.9 because hitting something like a grpc server these days is going to be far more common than an actual HTTP 0.9 server.

Solution 2


I figured it out. Make sure that curl is compiled with nghttp2.

If you are unsure, you can check it on your terminal using curl --version

If you dont find nghttp2/{version} you need to compile curl again with nghttp2.

curl --version example where nghttp2 is missing:

curl 7.66.0 (amd64-portbld-freebsd12.0) libcurl/7.66.0 OpenSSL/1.1.1d zlib/1.2.11

curl --version example where nghttp2 is available:

curl 7.64.1 (x86_64-apple-darwin19.0) libcurl/7.64.1 (SecureTransport) LibreSSL/2.8.3 zlib/1.2.11 nghttp2/1.39.2

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read

Leave a Comment