AWS S3 PHP SDK错误 - PHP致命错误:未找到类“RequestCore”

时间:2012-11-27 08:12:58

标签: php amazon-s3 amazon-web-services

在检查S3存储桶中是否存在对象时,我一直从AWS S3 API收到此错误。

代码看起来像这样:
第一个档案:

<?php 
require_once 'sdk-1.5.17/sdk.class.php';
require_once 'ReportHandler.php';

$report_handler = new ReportHandler();
$report_handler->generateWeeklyTotalsReport();
?>

第二档:

<?php
class ReportHandler {
     private $s3;

     public function __construct() {
          $this->s3 = new AmazonS3(); 
     }
     public function generateDailyTotalsReport() {
     ....
          if($this->s3->if_object_exists(BUCKET_NAME,OBJECT_NAME) {
     ....
    }
?>

详情
EC2 IMAGE :ami-49ec5a20
SDK :sdk-1.5.17
PHP版本:5.3.15
记录

Mon Nov 26 17:30:29 2012 error http://client 10.195.122.171 PHP Fatal error: Class   'RequestCore' not found in /var/www/html/sdk-1.5.17/utilities/request.class.php on line 30  
Mon Nov 26 17:30:29 2012 error http://client 10.195.122.171 PHP Stack trace:  
Mon Nov 26 17:30:29 2012 error http://client 10.195.122.171 PHP 1. {main}()   /var/www/html/WeeklyReport.php:0  
Mon Nov 26 17:30:29 2012 error http://client 10.195.122.171 PHP 2. ReportHandler-  >generateWeeklyTotalsReport() /var/www/html/WeeklyReport.php:16  
Mon Nov 26 17:30:29 2012 error http://client 10.195.122.171 PHP 3. ReportHandler-  >findOrCreateReport() /var/www/html/ReportHandler.php:111  
Mon Nov 26 17:30:29 2012 error http://client 10.195.122.171 PHP 4. AmazonS3-  >if_object_exists() /var/www/html/ReportHandler.php:148  
Mon Nov 26 17:30:29 2012 error http://client 10.195.122.171 PHP 5. AmazonS3-  >get_object_headers() /var/www/html/sdk-1.5.17/services/s3.class.php:2264  
Mon Nov 26 17:30:29 2012 error http://client 10.195.122.171 PHP 6. AmazonS3->authenticate()   /var/www/html/sdk-1.5.17/services/s3.class.php:1559  
Mon Nov 26 17:30:29 2012 error http://client 10.195.122.171 PHP 7. CFLoader::autoloader()   /var/www/html/sdk-1.5.17/services/s3.class.php:0  
Mon Nov 26 17:30:29 2012 error http://client 10.195.122.171 PHP 8. require_once()   /var/www/html/sdk-1.5.17/sdk.class.php:1428

我做错了吗?

1 个答案:

答案 0 :(得分:0)

确定。我犯了一个愚蠢的错误。

当从SDK中删除docs和examples目录时,我还删除了包含所有重要类的lib目录(当我这样做时已经很晚了:)。

返回后,一切正常。