我想在PHP的Amazon S3測試我的localhost
在Ubuntu系統上,但繼續得到同樣的錯誤:亞馬遜Web服務S3顯示SSL捲曲錯誤
S3::listBuckets(): [35] error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
這是顯示桶列表的功能。
public function buckets() {
$s3 = $this->getInstance();
/*print_r($this->_s3->listBuckets()); nothing is print else shows error */
return $this->_s3->listBuckets();
}
以下是此API函數調用的亞馬遜API函數。
public static function listBuckets($detailed = false) {
$rest = new S3Request('GET', '', '');
$rest = $rest->getResponse();
if ($rest->error === false && $rest->code !== 200)
$rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
if ($rest->error !== false) {
trigger_error(sprintf("S3::listBuckets(): [%s] %s", $rest->error['code'], $rest->error['message']), E_USER_WARNING);
return false;
}
$results = array();
if (!isset($rest->body->Buckets))
return $results;
if ($detailed) {
if (isset($rest->body->Owner, $rest->body->Owner->ID, $rest->body->Owner->DisplayName))
$results['owner'] = array(
'id' => (string) $rest->body->Owner->ID, 'name' => (string) $rest->body->Owner->ID
);
$results['buckets'] = array();
foreach ($rest->body->Buckets->Bucket as $b)
$results['buckets'][] = array(
'name' => (string) $b->Name, 'time' => strtotime((string) $b->CreationDate)
);
}
else
foreach ($rest->body->Buckets->Bucket as $b)
$results[] = (string) $b->Name;
return $results;
}
如果遠程服務器不說SSL,通常會發生這種情況。 –
它在另一臺服務器上工作正常。 –
您的'cURL'未編譯支持執行SSL請求。使用適當的二進制文件重新編譯。 – Ohgodwhy