The flow of saving data in DynamoDB by hitting the API with AmazonLinuxEC2, I wanted to do it with PHP, so I tried to include AWSSDK for PHP.
However, various issues occurred, so I will transcribe it as a memorandum for myself. I hope it helps.
$ cat /etc/system-release
Amazon Linux release 2 (Karoo)
$ sudo amazon-linux-extras install php7.2
$ sudo yum install php php-mbstring
$ sudo yum list installed | grep php
php-cli.x86_64 7.2.30-1.amzn2 @amzn2extra-php7.2
php-common.x86_64 7.2.30-1.amzn2 @amzn2extra-php7.2
php-fpm.x86_64 7.2.30-1.amzn2 @amzn2extra-php7.2
php-json.x86_64 7.2.30-1.amzn2 @amzn2extra-php7.2
php-mysqlnd.x86_64 7.2.30-1.amzn2 @amzn2extra-php7.2
php-pdo.x86_64 7.2.30-1.amzn2 @amzn2extra-php7.2
Reference: https://qiita.com/owlbeck/items/20f3e5402cb782f6291e
$ sudo yum install httpd
$ systemctl start httpd
$ systemctl status httpd
● httpd.service - The Apache HTTP Server
Active: active (running)
sudo yum install php-opcache
$ curl -sS https://getcomposer.org/installer | php
$ ls
composer.phar
$ php composer.phar
$ mv composer.phar /usr/local/bin/composer
$ composer
The last two lines just moved to a place where PATH is available. Now you can display a cool logo. Reference: https://getcomposer.org/doc/00-intro.md Reference: https://qiita.com/kakijin/items/02364adacf36410f449e
Do it in the root folder of your project.
$ sudo -i
$ cd /usr/local/bin/composer
$ vi composer.json //Write to json
composer.json
{
"require": {
"aws/aws-sdk-php": "3.*"
}
}
The AWS SDK for PHP3 series is compatible with PHP7.2 series.
$ php composer.phar install
$ composer require aws/aws-sdk-php
Write to php file and finish
require '/path/to/sdk/vendor/autoload.php';
Recommended Posts