Release: AWS SDK for PHP 1.3.3

Release Notes>PHP>Release: AWS SDK for PHP 1.3.3
This release adds support for CloudWatch custom user metrics, browser-based uploads to Amazon S3, simplifies the instantiation of certain classes for PHP 5.3 users, and fixes issues reported to the forums.

Details

Submitted By: RyanP@AWS
Release Date: May 11, 2011 2:46 AM GMT
Latest Version: 1.3.3
Created On: May 11, 2011 2:46 AM GMT
Last Updated: May 11, 2011 2:46 AM GMT

Download

Download the latest AWS SDK for PHP

New Features

Change Description

Custom User Metrics

Support for CloudWatch custom user metrics has been added to the SDK.

$cw = new AmazonCloudWatch();

$response = $cw->put_metric_data('Custom/', array(
    array( // First data set
        'MetricName' => 'MyData',
        'Dimensions' => array(
            array('Name' => 'CustomAttribute1', 'Value' => 'CustomAttributeValue1'),
            array('Name' => 'CustomAttribute2', 'Value' => 'CustomAttributeValue2'),
        ),
        'Timestamp' => 'today, midnight GMT',
        'StatisticValues' => array(
            'SampleCount' => 100,
            'Sum' => 1234567890,
            'Minimum' => 0,
            'Maximum' => 9999999999
        ),
        'Unit' => 'Bits'
    ),
));

For more information, please see Amazon CloudWatch Announces Custom Metrics, Lower Prices for Amazon EC2 Monitoring.

S3 Browser-Based POST

The S3BrowserUpload class has been added to the SDK. This class assists in generating the correct HTML/XHTML markup for uploading files to S3 via an HTML <form> element.

<?php
require_once 'sdk.class.php';
require_once 'extensions/s3browserupload.class.php';

$upload = new S3BrowserUpload();

// Generate the parameters for the upload.
$html_parameters = $upload->generate_upload_parameters('my-upload-bucket', '15 minutes', array(

    // Set permissions to private.
    'acl' => AmazonS3::ACL_PRIVATE,

    // Set various HTTP headers on the uploaded file.
    'Content-Disposition' => 'attachment; filename=information.txt',
    'Content-Encoding' => 'gzip',
    'Content-Type' => '^text/',
    'Expires' => gmdate(DATE_RFC1123, strtotime('January 1, 1970, midnight GMT')), // Format for the HTTP Expires header

    // The S3 Key to upload to. ${filename} is an S3 variable that equals the name of the file being uploaded.
    // We're also using PHP's built-in Filter extension in this example.
    'key' => '^user/' . filter_var($_POST['user_id'], FILTER_VALIDATE_INT) . '/${filename}',

    // Where should S3 redirect to after the upload completes? The current page.
    'success_action_redirect' => S3BrowserUpload::current_uri(),

    // Status code to send back on success. This is primarily to work around issues in Adobe® Flash®.
    'success_action_status' => 201,

    // Use reduced redundancy storage.
    'x-amz-storage-class' => AmazonS3::STORAGE_REDUCED
));
?>

<form action="<?= $html_parameters['form']['action'] ?>"
      method="<?= $html_parameters['form']['method'] ?>"
      enctype="<?= $html_parameters['form']['enctype'] ?>">

    <? foreach ($html_parameters['inputs'] as $name => $value): ?>
    <input type="hidden" name="<?= $name; ?>" value="<?= $value; ?>">
    <? endforeach; ?>

    <input type="file" name="file">
    <input type="submit" name="upload" value="Upload">
</form>

init()

Support for the init() method has been added to the CFArray, CFPolicy and CFSimpleXML classes, providing parity with the various service-specific classes. The init() method simplifies the process of constructing new instances and chaining from them in PHP 5.3+.

Hadoop Helpers

The CFHadoopBase class has been extracted out of CFHadoopStep as a shared library, and CFHadoopStep now extends from the CFHadoopBase class.

Resolved Issues

CloudFront Private URLs

Resolved an issue where the expires value for get_private_object_url() only accepted a string instead of a string or integer.

For more information, please see Bug in AmazonCloudFront::get_private_object_url.

CFJSON

Resolved an issue where a PHP 5.3-specific function was being used.

For more information, please see SDK 1.3.2 - Call to undefined function json_last_error().

RequestCore

Improvements have been made to address PHP environments with open_basedir enabled.

For more information, please see CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir.

Also, RequestCore now uses an up-to-date cacert.pem file from Mozilla instead of the Certificate Authority that libcurl or libopenssl was compiled with, which should resolve certain issues with making SSL connections to AWS services.

Known Issues

Issue Description

2GB limit for 32-bit stacks

Because PHP's integer type is signed and many platforms use 32-bit integers, the AWS SDK for PHP does not correctly handle files larger than 2GB on a 32-bit stack (whereby "stack" includes CPU, OS, web server, and PHP binary). This is a well-known PHP issue.

For more information, please see: PHP filesize: Return values. A workaround is suggested in AmazonS3::create_mpu_object() with files bigger than 2GB.

Supported API Versions

The AWS SDK for PHP supports the following services and API versions:

Service API Version
Amazon CloudFront 2010-11-01
Amazon CloudWatch 2010-08-01
Amazon Elastic Compute Cloud (Amazon EC2) with Amazon Virtual Private Cloud (Amazon VPC) 2011-02-28
Amazon Elastic MapReduce (Amazon EMR) 2009-03-31
Amazon Relational Database Service (Amazon RDS) 2010-07-28
Amazon Simple Storage Service (Amazon S3) 2006-03-01
Amazon SimpleDB 2009-04-15
Amazon Simple Email Service (Amazon SES) 2010-12-01
Amazon Simple Notification Service (Amazon SNS) 2010-03-31
Amazon Simple Queue Service (Amazon SQS) 2009-02-01
Auto Scaling 2010-08-01
AWS CloudFormation 2010-05-15
AWS Elastic Beanstalk 2010-12-01
AWS Identity and Access Management 2010-05-08
AWS Import/Export 2010-06-01
Elastic Load Balancing (ELB) 2010-07-01
©2017, Amazon Web Services, Inc. or its affiliates. All rights reserved.