I am trying to set up Amazon Aws Php SDK in Xampp.
After installing the SDK, I am trying to download a bucket from Amazon S3, using the following code.
<?php
error_reporting(-1);
ini_set('display_errors', 'on');
include_once ('aws/aws-autoloader.php');
use Aws\S3\S3Client;
$client = S3Client::factory(array(
'key' => '__my__key__',
'secret' => '__secret__key__'
));
$destination = 'downloaded_bucket';
$source_bucket = '__my__bucket__name';
$key_prefix = '';
$options = array('debug'=>true);
$client -> downloadBucket($destination,$source_bucket,$key_prefix,$options);
?>
Now on executing this php from my browser, I get the following error.
Notice: Use of undefined constant STDOUT - assumed 'STDOUT' in __my__path\Aws\S3\Sync\AbstractSyncBuilder.php on line 294
STDOUT
Warning: fwrite() expects parameter 1 to be resource, string given in __my__path\Aws\S3\Sync\DownloadSyncBuilder.php on line 124
STDOUT
Warning: fwrite() expects parameter 1 to be resource, string given in __my__path\Aws\S3\Sync\DownloadSyncBuilder.php on line 124
STDOUT
Warning: fwrite() expects parameter 1 to be resource, string given in __my__path\Aws\S3\Sync\DownloadSyncBuilder.php on line 124
The final 3 warnings occur because of the first Notice, because instead of resource, the string 'STDOUT' is passed.
What is the reason for the first notice? The code segment for this notice is
if ($this->debug) {
$this->addDebugListener($sync, is_bool($this->debug) ? STDOUT : $this->debug);
}
which is part of the SDK. And the culprit for the fwrite warning code is the addDebugListener function
protected function addDebugListener(AbstractSync $sync, $resource)
{
//blah blah
fwrite($resource, "Downloading {$from} -> {$to}\n");
//blah blah
}
My PHP version is 5.4.16