Reputation: 41
I keep getting this error: "OpenSSL SSL_read: No error" I did some research and I could not find anything. We created a new server with the same Settings, same files but for some reason we keep getting this error. The only difference is PHP 7.4 (on new server) vs PHP 7.1 and PHP 5.6 (on old servers). I don't think this is related to PHP version.
Apache/2.4.41 (Win64) OpenSSL/1.1.1c PHP/7.4.0 (new server)
Apache/2.4.33 (Win64) OpenSSL/1.1.0h PHP/7.2.5 (old server)
curl 7.55.1 (Windows)
Please help.
The new Servers are Windows Server 2019. These servers come with CURL already installed and the curl.exe is located in C:\Windows\System32. The version of this CURL is 7.55.1 OpenSSL/1.1.1c When I submit a CURL request from PHP file the CURL version is 7.67.0 OpenSSL/1.1.1a
When I sent the same curl request from command line I get all data (curl 7.55.1) but when I try through PHP (curl 7.67.0) I keep getting this error: "OpenSSL SSL_read: No error".
$headers = array(
"Content-type: text/xml",
"Content-length: " . strlen($xml),
"Connection: close",
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$data = curl_exec($ch);
$err = curl_error($ch);
Upvotes: 0
Views: 3109
Reputation: 41
I don't know if this can be considered as an answer.
I tested PHP versions: 7.3.14, 7.4.0 and (the latest at this time) 7.4.2. All these versions come with CURL 7.67.0 and each time when I sent a CURL request I got this error "OpenSSL SSL_read: No error". When I switched to PHP 7.3.12 or lower 7.2.5 that have CURL 7.64.0 and 7.59.0 everything worked without any problems. In all cases I used the latest Apache 2.4.41.
I saw that many developers had the same problem with CURL 7.67.0 https://github.com/curl/curl/issues/4624
If anyone knows the way how to use CURL 7.67.0 please let us know OR it looks like we have to wait for the next PHP version with new CURL.
Upvotes: 1