๋ชฉ์ฐจ
์ ๊ธฐ
์ ๋ง ๊ฐ๋จํ์ง๋ง, ์ฝ์ง์์๋.... aws phpsdk ์ค์น ํ๊ธฐ ์ ๋๋ค ใ .ใ
1. ์ฌ์ ์กฐ๊ฑด
# EC2 ์ธ์คํด์ค ํ๋กํ์ผ(role)์ค์
EC2 role ์ ๋ฐ๋์ S3 ๊ถํ์ ๋ฃ์ด์ค๋๋ค
(https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/guide_credentials.html)
2. aws php sdk ์ค์น
# install httpd php 7.2
yum install httpd -y
amazon-linux-extras install php7.2 -y
# install php-xml && ์๋น์ค ์ฌ์์ (์ค์)!!!
yum install php-xml -y
systemctl restart php-fpm
systemctl restart httpd
# install php composer
# 1. ์๋น์ค ๋ฃจํธ ๋๋ ํ ๋ฆฌ๋ก ์ด๋
cd /var/www/html
# 2. ์ค์น
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
# 3. ์ปดํฌ์ ๋ช
๋ น์ด๋ก ์ธ ์ ์๋๋ก ์ด๋
sudo mv /var/www/html/composer.phar /usr/bin/composer
# install aws phpsdk
composer require aws/aws-sdk-php
# sample code
https://docs.aws.amazon.com/code-samples/latest/catalog/code-catalog-php-example_code-s3.html << ์ถ์ฒ
https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/s3-examples-creating-buckets.html
# AWS SDK for php Document
728x90