PHP
AWS
Ubuntu

Ubuntuでaws-sdk-phpがインストールできない場合の対策ールできない場合の対策

下記のようなエラーが出た

$ composer require aws/aws-sdk-php
Using version ^3.80 for aws/aws-sdk-php
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - aws/aws-sdk-php 3.80.3 requires ext-simplexml * -> the requested PHP extension simplexml is missing from your system.
    - aws/aws-sdk-php 3.80.2 requires ext-simplexml * -> the requested PHP extension simplexml is missing from your system.
    - aws/aws-sdk-php 3.80.1 requires ext-simplexml * -> the requested PHP extension simplexml is missing from your system.
    - aws/aws-sdk-php 3.80.0 requires ext-simplexml * -> the requested PHP extension simplexml is missing from your system.
    - Installation request for aws/aws-sdk-php ^3.80 -> satisfiable by aws/aws-sdk-php[3.80.0, 3.80.1, 3.80.2, 3.80.3].

  To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php/7.2/cli/php.ini
    - /etc/php/7.2/cli/conf.d/10-opcache.ini
    - /etc/php/7.2/cli/conf.d/10-pdo.ini
    - /etc/php/7.2/cli/conf.d/20-calendar.ini
    - /etc/php/7.2/cli/conf.d/20-ctype.ini
    - /etc/php/7.2/cli/conf.d/20-exif.ini
    - /etc/php/7.2/cli/conf.d/20-fileinfo.ini
    - /etc/php/7.2/cli/conf.d/20-ftp.ini
    - /etc/php/7.2/cli/conf.d/20-gettext.ini
    - /etc/php/7.2/cli/conf.d/20-iconv.ini
    - /etc/php/7.2/cli/conf.d/20-json.ini
    - /etc/php/7.2/cli/conf.d/20-phar.ini
    - /etc/php/7.2/cli/conf.d/20-posix.ini
    - /etc/php/7.2/cli/conf.d/20-readline.ini
    - /etc/php/7.2/cli/conf.d/20-shmop.ini
    - /etc/php/7.2/cli/conf.d/20-sockets.ini
    - /etc/php/7.2/cli/conf.d/20-sysvmsg.ini
    - /etc/php/7.2/cli/conf.d/20-sysvsem.ini
    - /etc/php/7.2/cli/conf.d/20-sysvshm.ini
    - /etc/php/7.2/cli/conf.d/20-tokenizer.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Installation failed, deleting ./composer.json.

php-xmlをインストールすると解決する

sudo apt install php-xml

再度実行

$ composer require aws/aws-sdk-php

Using version ^3.80 for aws/aws-sdk-php
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 7 installs, 0 updates, 0 removals
  - Installing mtdowling/jmespath.php (2.4.0): Downloading (100%)         
  - Installing ralouphie/getallheaders (2.0.5): Downloading (100%)         
  - Installing psr/http-message (1.0.1): Downloading (100%)         
  - Installing guzzlehttp/psr7 (1.5.2): Downloading (100%)         
  - Installing guzzlehttp/promises (v1.3.1): Downloading (100%)         
  - Installing guzzlehttp/guzzle (6.3.3): Downloading (100%)         
  - Installing aws/aws-sdk-php (3.80.3): Downloading (100%)         
guzzlehttp/guzzle suggests installing psr/log (Required for using the Log middleware)
aws/aws-sdk-php suggests installing ext-curl (To send requests using cURL)
aws/aws-sdk-php suggests installing doctrine/cache (To use the DoctrineCacheAdapter)
aws/aws-sdk-php suggests installing aws/aws-php-sns-message-validator (To validate incoming SNS notifications)
Writing lock file
Generating autoload files

無事インストールできました。