0
votes

Failed opening required 'AWSSDKforPHP/aws.phar'
(include_path='.:/usr/share/pear:/usr/share/php:/home/ec2-user/pear/share/pear') in /var/www/html/index.php on line 3

This error appears when it is through browser and its working fine when i run PHP index.php in command line

<?php
    set_include_path(get_include_path() . PATH_SEPARATOR . '/home/ec2-    user/pear/share/pear');
    require 'AWSSDKforPHP/aws.phar';
    use Aws\S3\S3Client;



    // Use the high-level iterators (returns ALL of your objects).
    $objects = $s3->getIterator('ListObjects', array('Bucket' => $bucket));

    //echo "Keys retrieved!\n";
    echo "<h1>List of Blogs   </h1>";
    foreach ($objects as $object) {
    echo $object['Key'] . "\n";
}

?>
1

1 Answers

0
votes

This means that the file "AWSSDKforPHP/aws.phar" is not in the include path, probably the whole DIR AWSSDKforPHP is not in any of the included paths. If you are in the relevant dir while you run from command line it might work.