curl php HTTP/2 stream 0 was not closed cleanly

喜欢而已 提交于 2019-12-07 20:16:35

问题


I am trying to send a request using cURL and PHP and it throws an error.

HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)

I am sending CURLOPT_HTTP_VERSION like this

curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);

cURL info printed with curel_version() is

Array
(
    [version_number] => 475136
    [age] => 4
    [features] => 11518877
    [ssl_version_number] => 0
    [version] => 7.64.0
    [host] => x86_64-apple-darwin18.2.0
    [ssl_version] => OpenSSL/1.0.2q
    [libz_version] => 1.2.11
    [protocols] => Array
        (
            [0] => dict
            [1] => file
            [2] => ftp
            [3] => ftps
            [4] => gopher
            [5] => http
            [6] => https
            [7] => imap
            [8] => imaps
            [9] => ldap
            [10] => ldaps
            [11] => pop3
            [12] => pop3s
            [13] => rtmp
            [14] => rtsp
            [15] => scp
            [16] => sftp
            [17] => smb
            [18] => smbs
            [19] => smtp
            [20] => smtps
            [21] => telnet
            [22] => tftp
        )

    [ares] => 1.15.0
    [ares_num] => 69376
    [libidn] => 
    [iconv_ver_num] => 0
    [libssh_version] => libssh2/1.8.0
    [brotli_ver_num] => 16777223
    [brotli_version] => 1.0.7
)

PHP version: PHP Version => 7.3.2

installed with homebrew.

I have tried almost all of the solutions here on SO, but still getting the same error. Do I need to download and compile PHP from source? Any clue/suggestion would be a huge help. Thanks.

来源:https://stackoverflow.com/questions/55211579/curl-php-http-2-stream-0-was-not-closed-cleanly

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!