2014-01-06 57 views
4

這是我正在使用的簡化但準確的代碼。Amazon S3 - deleteObjects() - 「guzzle」錯誤?

$client = S3Client::factory(array('key'=>$ak,'secret'=>$sk)); 

foreach(range(1,10) as $i) $temp[] = array('Key'=>$i); 

$result = $client->deleteObjects(array('Bucket'=>'bucket','Objects'=>$temp)); 

return $result; 

一切正常,它刪除所請求的對象,但它會從phar文件中引發所有這些錯誤。正如您在下面看到的那樣在本地運行。

Fatal error: Uncaught exception 'Guzzle\Http\Exception\CurlException' with message '[curl] 56: Problem (2) in the Chunked-Encoded data [url] https://bucket.s3.amazonaws.com?delete=' in phar://C:/wamp/www/bucket/local/aws.phar/Aws/Common/Client/AbstractClient.php on line 285

Guzzle\Http\Exception\CurlException: [curl] 56: Problem (2) in the Chunked-Encoded data [url] https://bucket.s3.amazonaws.com?delete= in phar://C:/wamp/www/bucket/local/aws.phar/Guzzle/Http/Curl/CurlMulti.php on line 365

Aws\Common\Exception\TransferException: [curl] 56: Problem (2) in the Chunked-Encoded data [url] https://bucket.s3.amazonaws.com?delete= in phar://C:/wamp/www/bucket/local/aws.phar/Aws/Common/Client/AbstractClient.php on line 285

+0

我目前有同樣的問題,當我嘗試從桶中獲取文件列表時,通常會顯示它。也許foareach()有問題?我正在用WAMP測試Windows 7。 – joshas

+0

同樣在這裏,win7 x64和wamp。 – Mickey

回答

0

可行的辦法是

'curl.options' => array('CURLOPT_HTTP_VERSION'=>'CURL_HTTP_VERSION_1_0') 

添加到S3Client ::工廠選項。

沒有更多的提到curl錯誤,但現在我有時會收到簡單的XML錯誤:「Entity:line 2:parser error:Extra content in the end of the document」。

+0

我補充說,現在我得到了原始錯誤和3個額外的簡單xml __construct()錯誤:/ - 不用說,一切仍然正常運行..只是更多的錯誤。 – Mickey

1

我很晚才意識到,但搜索這個返回非常少,希望這可能會幫助別人。

我只是在試圖刪除對象,WAMPSERVER(64 BITS & PHP 5.4)2.4,Windows 7 x64時纔出現此錯誤。我認爲這個版本的WAMP中的Curl擴展名有些問題。我安裝了WAMPSERVER(32BITS & PHP 5.4)2.4,並且沒有與deleteObjects有關的問題。

2

我也有這個問題在Windows 7 x64上運行WampServer。通過愚蠢的運氣,我偶然發現瞭解決方案。

只需將'scheme' => 'http'添加到出廠配置設置並開始工作!