我試圖連接到AWS版本3 SDK存儲桶。PHP AWS SDK 3錯誤:AWS HTTP錯誤:cURL錯誤6:無法解析主機:s3.oregon.amazonaws.com
不過,我收到以下錯誤:
PHP Fatal error: Uncaught exception 'Aws\S3\Exception\S3Exception' with message 'Error executing "PutObject" on " https://s3.oregon.amazonaws.com/my-buekct-test/hello_world.txt "; AWS HTTP error: cURL error 6: Could not resolve host: s3.oregon.amazonaws.com (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)'
這是我的代碼,只是簡單的。
<?php
header('Content-Type: text/plain; charset=utf-8');
// Include the SDK using the Composer autoloader
require 'vendor/autoload.php';
$s3 = new Aws\S3\S3Client([
'region' => 'Oregon',
'version' => 'latest',
'credentials' => [
'key' => 'Enter the key',
'secret' => 'Enter the Secret key'
]
]);
// Send a PutObject request and get the result object.
$key = 'hello_world.txt';
$result = $s3->putObject([
'Bucket' => 'my-buekct-test',
'Key' => $key,
'Body' => 'this is the body!'
]);
// Print the body of the result by indexing into the result object.
echo $result['Body'];
我使用AWS的CentOS,PHP 21年5月5日,阿帕奇2.4.10
你能幫指出在哪裏我會錯呢?
哇!非常感謝你!!成功 – jonggu
謝謝你,你救了我的一天:) –