Sto tentando di impostare Amazon Aws Php SDK in Xampp.Avviso: Uso della costante non definita STDOUT - presupposto 'STDOUT'
Dopo aver installato l'SDK, sto cercando di scaricare un bucket da Amazon S3, utilizzando il seguente codice.
<?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);
?>
Ora durante l'esecuzione di questo php dal mio browser, ottengo il seguente errore.
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
Gli ultimi 3 avvertimenti si verificano a causa del primo avviso, perché invece di risorse, viene passata la stringa 'STDOUT'.
Qual è il motivo del primo avviso? Il segmento di codice per questo avviso è
if ($this->debug) {
$this->addDebugListener($sync, is_bool($this->debug) ? STDOUT : $this->debug);
}
che fa parte del SDK. E il colpevole per il codice di avviso fwrite è la funzione addDebugListener
protected function addDebugListener(AbstractSync $sync, $resource)
{
//blah blah
fwrite($resource, "Downloading {$from} -> {$to}\n");
//blah blah
}
La mia versione di PHP è 5.4.16
potrebbe essere necessario definire STDOUT se non definito, che cosa è in linea di 124 – DevZer0
penso che ci sia qualche altro file di bootstrap che non viene incluso che dovrebbe essere .. uno che ha 'define ("STDOUT", "php: // output"); ' – Orangepill
@ DevZer0 Una chiamata fwrite. Ho aggiornato la domanda. – SatheeshJM