The AWS SDK for PHP helps you get started in minutes using a single, downloadable package. Using the PHP SDK, you can build solutions for many AWS products, such as Amazon Simple Storage Service (Amazon S3), Amazon Elastic Compute Cloud (Amazon EC2), and Amazon SimpleDB.

Follow the on-screen instructions. If you don't already have an AWS account, you are prompted to create one as part of the sign-up process.

AWS sends you a confirmation e-mail after the sign-up process is complete. You can view your current account activity or manage your account at any time, by going to aws.amazon.com and clicking the Account tab.

Get Your Credentials

In order to use the AWS SDK for PHP, you need your AWS Access Key ID and Secret Access Key.

Scroll down to Access Credentials and make sure the Access Keys tab is selected.
The AWS Access Key ID appears in the Access Key column.

To view the Secret Access Key, click Show.

Important! Your Secret Access Key is a secret, which only you and AWS should know. It is important to keep it confidential to protect your account. Store it securely in a safe place. Never include it in your requests to AWS, and never e-mail it to anyone. Do not share it outside your organization, even if an inquiry appears to come from AWS or Amazon.com. No one who legitimately represents Amazon will ever ask you for your Secret Access Key.

Set Up Your Environment

Aside from a baseline understanding of object-oriented programming in PHP, there are a few minimum requirements to start using the AWS SDK for PHP. All the following requirements are common, and most extensions come installed with PHP 5.2 by default.

If you're not sure if your PHP installation supports these requirements, you can run the AWS SDK for PHP Compatibility Test. (Alternatively, you can check by either running phpinfo() in a browser or by running php -i from the command line.)

To install your PHP environment

Use the links in the following table to get the appropriate installation for your environment:

Configure the SDK Security Credentials

There are two different ways to configure your credentials: one approach is geared for simplicity, whereas the other is geared for flexibility. The simple approach is preferred for all installation approaches except PEAR. This flexible approach is preferred if you are installing from PEAR; if you need it, find a copy of the config-sample.inc.php file on GitHub.

To add your AWS credentials the simple way (non-PEAR)

Navigate to the config-sample.inc.php file in the SDK directory, and rename it to config.inc.php.

Open config.inc.php for editing. There are instructions in this file for what each configuration value, should be and where you can find it.

When the SDK is loaded, it will first look for config.inc.php in the same directory as sdk.class.php. You are now ready to run the sample!

Caution! Be sure to back up your config.inc.php file when upgrading to avoid having to re-enter your credentials.

To add your AWS credentials the flexible way (PEAR)

Create a new configuration file at ~/.aws/sdk/config.inc.php.
You can either download and copy the contents of a config-sample.inc.php file, or grabdirectly from the above GitHub link.

Open config.inc.php for editing. There are instructions in this file for what each configuration value, and where you can find it.

Enter echo getenv('HOME'); to verify that PHP can access the HOME environment variable .

If the previous command doesn't t return the correct file path to your user directory, configure it with putenv('HOME=<your-user-path>');.

Run the Sample

The AWS SDK for PHP contains sample code demonstrating how to use the AWS SDK for PHP with Amazon S3. The sample creates an Amazon S3 bucket, uploads a number of files from a test-files/ directory in to the bucket, then displays a URL for each file.

Run the cli-s3_get_urls_for_uploads.php file located in the samples/ folder of the SDK installation directory.

Where Do I Go from Here?

For more information about the AWS SDK for PHP, including a complete list of supported AWS products, go to aws.amazon.com/sdkforphp.

SDK Reference Documentation

The SDK reference documentation includes the ability to browse and search across all code included with the SDK. It provides thorough documentation, usage examples, and even the ability to browse method source. You can find it at http://docs.amazonwebservices.com/AWSSDKforPHP/latest.

Tutorials and Screencasts

Learn more about using the AWS SDK for PHP from our list of articles, tutorials, and screencasts: