요약:
1. Compatibility 확인
https://github.com/amazonwebservices/aws-sdk-for-php/tree/master/_compatibility_test/
2. ssl 지원하는 curl 깔기:
sudo apt-get remove --purge php5-curl && \
sudo apt-get install libcurl4-openssl-dev curl-ssl php5-curl
3. APC 설치:
apt-cache search apc
로 검색하여 설치(php-apc)
4. 나머지 component들도 비슷하게 설치...
AWS SDK for PHP
PHP Environment Compatibility Test (CLI)
----------------------------------------
PHP 5.2 or newer............ Yes 5.3.10-1ubuntu3.4
64-bit architecture......... Yes
cURL with SSL............... Yes 7.22.0 (OpenSSL/1.0.1)
Standard PHP Library........ Yes
SimpleXML................... Yes
DOM......................... Yes
JSON........................ Yes
PCRE........................ Yes
File system read/write...... Yes
OpenSSL extension........... Yes
Zlib........................ Yes
APC......................... Yes
XCache...................... No
Memcache.................... Yes
Memcached................... Yes
PDO......................... Yes
SQLite 2.................... No
SQLite 3.................... No
PDO-SQLite driver........... No
open_basedir disabled....... Yes
safe_mode disabled.......... Yes
Garbage Collector enabled... Yes
Valid SSL certificate....... Yes
----------------------------------------
Your environment meets the minimum requirements for using the AWS SDK for PHP!
* The OpenSSL extension is installed. This will allow you to use CloudFront
Private URLs and decrypt Windows instance passwords.
* The Zlib extension is installed. The SDK will request gzipped data
whenever possible.
* Storage types available for response caching:
The file system, APC, Memcached
----------------------------------------
Bottom Line: Yes, you can!
Your PHP environment is ready to go, and can take advantage of all possible features!
Recommended settings for config.inc.php
CFCredentials::set(array(
'@default' => array(
'key' => 'aws-key',
'secret' => 'aws-secret',
'default_cache_config' => 'apc' ,
'certificate_authority' => false
)
));
Getting Started with the AWS SDK for PHP
Details
Submitted By: | Craig@AWS |
AWS Products Used: | Amazon CloudFront, Amazon EC2, Amazon S3, Amazon SQS, Amazon SimpleDB |
Language(s): | PHP |
Created On: | |
Last Updated: |
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.
Get Set Up
To get set up, you must sign up for Amazon Web Services, get your AWS credentials, and set up your environment.
Sign Up for AWS Products
Before you can begin, you must sign up for each AWS product you want to use. The sample included in the SDK uses Amazon S3, so we'll use that product as an example here.
To sign up for a product- Go to the home page for the product, for example aws.amazon.com/s3/.
Tip: Go to aws.amazon.com/products for a list of links to all our products. - Click the sign-up button on the top right corner of the page.
- 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.
To get your AWS Access Key ID and Secret Access Key- Go to http://aws.amazon.com/.
- Click Account and then click Security Credentials.
The Security Credentials page displays (you might be prompted to log in). - 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.
Minimum requirements are:
- PHP 5.2 or newer (5.2.14 or latest 5.3.x highly recommended).
Including SimpleXML, JSON, PCRE and SPL. - cURL PHP extension (compiled with the OpenSSL libraries for HTTPS support).
- Ability to read from, and write to, the file system via file_get_contents() and file_put_contents().
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:
OS Install Mac OS X
MacPorts, MAMP, Apache Friends XAMPP, BitNami MAMPStack, BitNami MAPPStack
Linux
Depending on your distribution, you can likely install everything you need via yum or apt-get; Apache Friends XAMPP, BitNami LAMPStack, BitNami LAPPStack
Windows
WAMP, Apache Friends XAMPP, BitNami WAMPStack, BitNami WAPPStack
Amazon EC2 AMIs
- To use Amazon CloudFront, you must have the OpenSSL PHP extension (which is different from any low-level OpenSSL libraries installed on your system) to sign private CloudFront URLs.
- To use response caching with the following tools, you must install the associated extensions:
Install the SDK
There are a few ways you can grab the source for the AWS SDK for PHP, each option is described briefly here.
To install the AWS SDK for PHP
- Choose your installation method from one of the following:
- Install from downloadable file from http://aws.amazon.com/sdkforphp
- Install from Git. For more information on Git, explore Git for the lazy, or other Git references.
git clone git://github.com/amazonwebservices/aws-sdk-for-php.git AWSSDKforPHP
cd ./AWSSDKforPHP - Install from Subversion
svn co http://svn.github.com/amazonwebservices/aws-sdk-for-php.git AWSSDKforPHP
cd ./AWSSDKforPHP - Install from PEAR
sudo pear channel-discover pear.amazonwebservices.com
sudo pear install aws/sdk
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 toconfig.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 assdk.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.
Important! Before you run the sample you must configure the SDK with your AWS security credentials. For more information, see Configure the SDK Security Credentials.
To run the Amazon S3 Sample
- Run the
cli-s3_get_urls_for_uploads.php
file located in thesamples/
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 toaws.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 athttp://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:
'Web Service > AWS' 카테고리의 다른 글
EC2로 git 서버 구축하기 (0) | 2013.03.04 |
---|---|
SES 이용하여 메일 보내기 (0) | 2012.08.22 |
postfix를 이용하여 메일을 다른 계정으로 포워딩하기 (0) | 2012.08.20 |
디스크 채우기 테스트(대용량 파일 생성) (0) | 2012.08.15 |
[mhddfs]여러 disk 하나로 mount 하기 (0) | 2012.08.14 |