Coder Social home page Coder Social logo

aws-sdk-for-php's Introduction

AWS SDK for PHP - Version 1

This is the repository for Version 1 of the AWS SDK for PHP.

The latest version of the SDK can be found at aws/aws-sdk-php.

Please follow us on Twitter (@awsforphp) and our blog.

aws-sdk-for-php's People

Contributors

awstools avatar borlak avatar jeremeamia avatar mtdowling avatar skyzyx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-sdk-for-php's Issues

RequestSpotInstances

Hi,

Looks like I've found one more bug in the RequestSpotInstances call:

PHP Warning: rawurlencode() expects parameter 1 to be string, array given in AWSSDKforPHP/utilities/utilities.class.php on line 156

Call of select method of SimpleDB with ConsistentRead flag may not properly work.

The following code will not work with error message; "InvalidParameterValue: Value () for parameter ConsistentRead is invalid. The ConsistentRead flag should be either true or false".

$sdb = AmazonSDB();
$result = $sdb->select("select * from item", array(
    'ConsistentRead' => true,
);

The following code will work.

$sdb = AmazonSDB();
$result = $sdb->select("select * from item", array(
    'ConsistentRead' => 'true',
);

Is it proper behavior?
Is ConsistentRead flag string value not boolean value?

Mac MAMP PHP 5.4.X cast to String making crash

In the Lastest SDK s3.class.php get_canonical_user_id function:

return array(
            'id' => (string) $id->body->Owner->ID,
            'display_name' => (string) $id->body->Owner->DisplayName
        );

The Converting to String making the Apache server crash.

Get SQS message attributes

How does one get the attributes of a SQS message?

$sqs->receive_message($queueUrl, array('AttributeName'=>'provider'));
or
$sqs->receive_message($queueUrl, array('AttributeName'));

Does not seem to be correct.

Bucket Headers giving 403 error

I am trying to retrieve all the content from s3 bucket but is throwing 403 status code.
$s3 = new AmazonS3(array('key' => AWS_S3_KEY, 'secret' => AWS_S3_SECRET));
$options = array('prefix' => $bucket_path); // In this case $bucket_path = '';
$bucket = $s3->get_bucket_headers($bucket_name, $options);

but $bucket->status is showing 403.

List all ec2 instances

I am trying to list all ec2 instances, and have the following:

<?php
    namespace Aws\Common\Aws;
    namespace Aws\Ec2;

    require_once(dirname(__DIR__) . "/lib/aws/aws-autoloader.php");

    $aws = Aws::factory(array(
        'key'    => getenv('amazon_key'),
        'secret' => getenv('amazon_secret')
    ));

    $ec2 = $aws->get("ec2");
    $instances = $ec2->DescribeInstances();

    print_r($instances);
?>

But I am getting:

Fatal error: Class 'Aws\Ec2\CSRF' not found

"Error creating resource" when attempting to open a read stream

Hi again! I'm the author of the S3 File System module for Drupal, and my module's users have been using AWS SDK for PHP 2 for several months, now. It works fantastically, and actually provided a noticeable performance boost over using SDK1.

However, a smattering of my users have run into a really perplexing problem, which my attempts at debugging have shown to apparently be a bug in Guzzle\Stream\PhpStreamRequestFactory->createResource(). Maybe.

Here's how my _open_read_stream() function looks (it's almost a line-for-line copy of the SDK's Aws\S3\StreamWrapper->openReadStream() function):

// Create the command and serialize the request.
$request = $this->_get_signed_request($this->s3->getCommand('GetObject', $params));
// Create a stream that uses the EntityBody object.
$factory = $this->_get_option('stream_factory');
if (empty($factory)) {
  $factory = new Guzzle\Stream\PhpStreamRequestFactory();
}
$this->body = $factory->fromRequest($request, array(), array('stream_class' => 'Guzzle\Http\EntityBody'));

That $factory->fromRequest() call eventually leads down into PhpStreamRequestFactory->createResource(), which 99.99% of the time works just fine. But sometimes, for no reason that I've been able to determine, createResource()'s call to the PHP library function stream_context_create() (which happens due to it being called from a closure defined in PhpStreamRequestFactory->createContext()) fails silently. It returns FALSE, but also doesn't set an error, so createResource()'s call to error_get_last() returns NULL, which triggers a warning from the foreach not being given a valid iterable, in addition to throwing the RuntimeException that reports 'Error creating resource'.

I have absolutely no idea why stream_context_create() is failing. In fact, the docs for that function don't even mention it being capable of returning FALSE, though the createResource() function clearly knows that it can. Not being given any error message further complicates the issue.

I'm just hoping that you guys' experience with this part of PHP might grant you some insight into how this could be happening.

max_retries

In many places in the PHP SDK max_retries is compared using the <= operator, resulting in a max_retries of 0 meaning "retry once". I found this comparison in 5+ source files, here is the example I hit:

    # (Line 948 sdk.class.php)

    if ($this->redirects <= $this->max_retries)
    {
        // Exponential backoff
        $delay = (integer) (pow(4, $this->redirects) * 100000);
        usleep($delay);
        $this->redirects++;
        $data = $this->authenticate($operation, $original_payload);
    }

Unwanted white-space in html source

For some reason this sdk is creating whitespace in the html source.

This is how my html document appears currently, the doctype should not have any leading white space.

I've tried finding where this happening but am unable to locate the issue.

Also, if I copy that whitespace and paste it in a word document, it actually draws a 2 cell tablet, so I'm not sure if perhaps the issue is bad text encoding.

Anyone experience a similar issue?

Unable to install with composer

Hello,
I am getting following message. I am having this issue on mac. Linux server was able to install the sdk through composer.
Updating dependencies (including require-dev)

  • Installing aws/aws-sdk-php (2.4.2)
    Downloading: 100%

    [UnexpectedValueException]
    '/Users/xyz/Sites/works/vendor/aws/aws-sdk-php/ed
    a362215aae6a8698f234ad073454f0.2' is not a zip archive.

Support China region?

Hi

I can't find china region(cn-north-1)'s setting in ec2 service?
this sdk not support china region?

Thank You

Please can you create a tag for the latest merged pull requests?

I've just found this merged pull request when looking for a fix to the "Use of undefined constant CURLOPT_CLOSEPOLICY" problem when running our code on a new box...

#71

As we're using the cybernox/amazon-webservices-bundle Symfony bundle package in our project it's not pulling in this update. Please can you tag this so that this patch it can be included?

add Expires headers

Hello.

I want add Expires headers to my images .
I use the KnpGaufretteBundle with this library.

Somebody knows how can I add expire headers ? thanks in advance! : )

SignatureDoesNotMatch Error

@jeremeamia , I am getting a SignatureDoesNotMatch response from Amazon. However, my keys are correct. I have tested the generated signature by generating one outside of the SDK for verification. I think the problem is here:

This is the string that is being used to generate the signature:

PUT
JtUx3diApbCp4pI5KQ4F/Q==
application/octet-stream
Fri, 25 Apr 2014 16:00:40 GMT
x-amz-acl:public-read
/myBucket/one.m4a

However, the amazon response contains two copies of the stringtosign. The first one is the same as above and is sent in the header. The second is sent in the body and looks like this:

PUT
JtUx3diApbCp4pI5KQ4F/Q==
application/octet-stream; boundary=----------------------------b98b484efce0
Fri, 25 Apr 2014 16:00:40 GMT
x-amz-acl:public-read
/myBucket/one.m4a

Where is this coming from?

; boundary=----------------------------b98b484efce0

I believe that amazon is checking the signature based on this stringtosign, which is why I'm receiving an invalid signature response.

P.S. I'm using Gaufrette (within a Symfony2 app).

Cleanup global namespace

sdk.class.php issues a call to unset() at the bottom of the file, and unsets several variables. At the surface, this is good housekeeping. However, these are all in the global namespace and therefore conflict with the calling scope.

A concrete example: I'm using the SDK in Drupal, and their library loading mechanism uses a variable called $path in the vary part of the code that requires this file, and it's in a loop (loading several of the files in this sdk). After including sdk.class.php, the $path variable is no longer present and subsequent file paths can no longer be created.

My suggestion is to use 'aws' namespaced variables (and not necessarily the PHP Namespace feature, though that would be great), but at least things like $aws_config_path instead of simply $path if you must use a global scope.

Cheers!

Could not upload to s3 anymore

Hello,

We're currently using this library for quite sometime now and suddenly it won't allow us to upload images to s3.

Here's our "legacy" code.

    $sendResult = $s3->create_object($bucket, $filename, [
      'fileUpload'  => $localFilePath,
      'acl'         => \AmazonS3::ACL_PUBLIC,
      'contentType' => \Raika\File::getMimeType($localFilePath),
      'headers'     => [
        'Cache-Control' => 'max-age=31536000', // Cache for one year
      ]
    ]);
    if (!($ret = $sendResult->isOK())) {
      \Yii::log("Failed uploading to S3: $bucket/$filename", \CLogger::LEVEL_ERROR, __CLASS__);
    }

Files are existing locally that only lead me to the assumption that there's something with wrong with s3.

Is this library still expect to work or is there something wrong with s3?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.