Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8866005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:40:13+00:00 2026-06-14T16:40:13+00:00

So the AWS php sdk 2.x library has been put out recently and I’ve

  • 0

So the AWS php sdk 2.x library has been put out recently and I’ve taken a turkey day plunge into upgrading from 1.5x. My first was to upgrade my S3 backup class. I’ve quickly run into an error:

Fatal error: Class 'EntityBody' not found in /usr/share/php/....my file here

when trying to upload a zipped file to an S3 bucket. I wrote a class to abstract the writing a bit to allow for multi-region backup, so the code below references to $this are that.

$response1 = $s3->create_object(
        $this->bucket_standard,
        $this->filename,
        array(
         'fileUpload'  => $this->filename,
         'encryption' => 'AES256',
         //'acl'         => AmazonS3::ACL_PRIVATE,
         'contentType' => 'text/plain',
         'storage'     => AmazonS3::STORAGE_REDUCED,
         'headers'     => array( // raw headers
                              'Cache-Control'    => 'max-age',
                              //'Content-Encoding' => 'gzip',
                              'Content-Language' => 'en-US'
                              //'Expires'       => 'Thu, 01 Nov 2012 16:00:00 GMT'
                            ),
          'meta'     => array(
                              'param1' => $this->backupDateTime->format('Y-m-d H:i:s'),     // put some info on the file in meta tags
                              'param2' => $this->hostOrigin
                            ) 
            )
      );

The above worked fine on 1.5.x.

Now, in 2.x, I’m looking into their docs and they’ve changed just about everything (great…maximum sarcasm)

$s3opts=array('key'=> $this->accessKey, 'secret' => $this->secretKey,'region' => 'us-east-1');
$s3 = Aws\S3\S3Client::factory($s3opts);

so now I’ve got a new S3 object. And here is my 2.x syntax to do the same exact thing. My problem arises where they’ve (sinisterly) changed the old “fileupload” to “Body” and made it more abstract in how to actually attach a file! I’ve tried both and I’m thinking it has to do with the dependencies (Guzzle or Smyfony etc), but I get the error above (or substitute Stream if you like) whenever I try to execute this.

I’ve tried using Composer with composer.json, and the aws.phar but before I get into that, is there something dumb I’m missing?

$response1 = $s3->putObject(array(
        'Bucket' => $this->bucket_standard,
        'Key'    => $this->filename,
        'ServerSideEncryption' => 'AES256',
        'StorageClass' => 'REDUCED_REDUNDANCY',
        'Body' => EntityBody::factory(fopen($this->filename, 'r')),
        //'Body' => new Stream(fopen($fullPath, 'r')),

        'MetaData' => array(
                              'BackupTime' => $this->backupDateTime->format('Y-m-d H:i:s'),     // put some info on the file in meta tags
                              'HostOrigin' => $this->hostOrigin
                            ) 
      ));

Thanks as always,

R

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T16:40:15+00:00Added an answer on June 14, 2026 at 4:40 pm

    Did you import the EntityBody into your namespace?

    use Guzzle\Http\EntityBody;
    

    Otherwise, you’d have to do

    'Body' => \Guzzle\Http\EntityBody::factory(fopen($this->filename, 'r')),
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to understand amazon php sdk for AWS but I really can't use
My problem: require_once '/includes/aws-sdk-1.5.2/sdk.class.php'; My environment: I have a pretty standard PHP site that
I have been looking into AWS spot instances for some jobs however instead of
I am trying to use the aws sdk for php to create temporary credentials
I would like to use the Amazon AWS SDK for PHP in my Yii
I recently set up an AWS EC2 instance and installed Apache, PHP, and MySQL
When using the AWS SDK for PHP with SimpleDB (a mouthful) the select section
What I have noticed is that responses from AWS PHP SDK are sometimes a
I am using the PHP version of Amazon's AWS SDK. I have a bunch
I have been using Amazon SES for sometime now through the PHP library found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.