google-cloud-php: cURL error 35: Encountered end of file

I have this code:

...
$bucket_obj = $bucket->object($img_file);
if ($bucket_obj && $bucket_obj->exists()) {
            $cloud_image = $bucket_obj->downloadAsString([
                'retries' => 0,
                'httpOptions' => [ 'debug' => $fp ]
            ]);
            if ($cloud_image) {
                $file_found = true;
            }
        }

...
..

but while calling the downloadAsString method I receive this error:

nginx_error www 2016/08/08 12:48:22 [error] 9523#0: *1064934 FastCGI sent in stderr: "PHP message: PHP Notice: Error while requesting [f9fa6866f3f06bd6474f2fed564aafba66af.jpg] at Google Cloud Storage [cURL error 35: Encountered end of file (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)]. Trace: #0 /var/www/html/public/vendor/google/cloud/src/RequestWrapper.php(151): GoogleCloudRequestWrapper->convertToGoogleException(Object(GuzzleHttpExceptionConnectException))
nginx_error www #1 /var/www/html/public/vendor/google/cloud/src/Storage/Connection/Rest.php(196): GoogleCloudRequestWrapper->send(Object(GuzzleHttpPsr7Request), Array)
nginx_error www #2 /var/www/html/public/vendor/google/cloud/src/Storage/Object.php(208): GoogleCloudStorageConnectionRest->downloadObject(Array)
nginx_error www #3 /var/www/html/public/test.php(727): GoogleCloudStorageObject->downloadAsString(Array)

What can it be and how do I prevent this from happening?

I tried to pass some options to the method to get some debug info: [ 'retries' => 0, httpOptions' => [ 'debug' => $fp ] ]

but apparently this doesn’t work either. Is there a documentation or anything about these options? The only thing I can find in the doc is options array Configuration options. which doesn’t help that much :p

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 21 (11 by maintainers)

Most upvoted comments

@Salv0 @jdpedrie I’m getting same issues with curl: From time to time error:

cURL error 35: Encountered end of file (see http://curl.haxx.se/libcurl/c/libcurl-errors.htm)

curl --version curl 7.49.1 (x86_64-pc-linux-gnu) libcurl/7.49.1 NSS/3.24 Basic ECC zlib/1.2.8 Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp Features: AsynchDNS IPv6 Largefile NTLM NTLM_WB SSL libz UnixSockets

Any solutions?

Hey David, at the moment I am not at work and I will be back for the end of the month. I will proceed with your suggestion as soon as I am back and let you know the results!

Thank you again for the help!