まずLaravelプロジェクトのcomposer installまでの手順はQiitaなどの技術系ブログ記事に多くの手順ブログがありますのでこちらをご覧ください。
私が参考にしたデプロイ記事はこちらになります。
https://qiita.com/nakm/items/0bcc6564538a0604b2ce
PHPのバージョンについては適宜対応してください。
EC2インスタンス内でcomposer installをしようとすると。。。下記のようなエラー
[ec2-user@ip-172-31-36-11 laravel]$ composer install
>
Problem 1
- Installation request for aws/aws-sdk-php 3.135.2 -> satisfiable by aws/aws-sdk-php[3.135.2].
- aws/aws-sdk-php 3.135.2 requires ext-simplexml * -> the requested PHP extension simplexml is missing from your system.
Problem 2
- Installation request for doctrine/dbal 2.10.2 -> satisfiable by doctrine/dbal[2.10.2].
- doctrine/dbal 2.10.2 requires ext-pdo * -> the requested PHP extension pdo is missing from your system.
Problem 3
- Installation request for laravel/framework v7.6.2 -> satisfiable by laravel/framework[v7.6.2].
- laravel/framework v7.6.2 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
Problem 4
- Installation request for league/commonmark 1.3.4 -> satisfiable by league/commonmark[1.3.4].
- league/commonmark 1.3.4 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
Problem 5
- Installation request for tijsverkoyen/css-to-inline-styles 2.2.2 -> satisfiable by tijsverkoyen/css-to-inline-styles[2.2.2].
- tijsverkoyen/css-to-inline-styles 2.2.2 requires ext-dom * -> the requested PHP extension dom is missing from your system.
Problem 6
- Installation request for facade/ignition 2.0.2 -> satisfiable by facade/ignition[2.0.2].
- facade/ignition 2.0.2 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
Problem 7
- Installation request for phar-io/manifest 1.0.3 -> satisfiable by phar-io/manifest[1.0.3].
- phar-io/manifest 1.0.3 requires ext-dom * -> the requested PHP extension dom is missing from your system.
Problem 8
- Installation request for phpunit/php-code-coverage 7.0.10 -> satisfiable by phpunit/php-code-coverage[7.0.10].
- phpunit/php-code-coverage 7.0.10 requires ext-dom * -> the requested PHP extension dom is missing from your system.
Problem 9
- Installation request for phpunit/phpunit 8.5.3 -> satisfiable by phpunit/phpunit[8.5.3].
- phpunit/phpunit 8.5.3 requires ext-dom * -> the requested PHP extension dom is missing from your system.
Problem 10
- Installation request for scrivo/highlight.php v9.18.1.1 -> satisfiable by scrivo/highlight.php[v9.18.1.1].
- scrivo/highlight.php v9.18.1.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
Problem 11
- Installation request for theseer/tokenizer 1.1.3 -> satisfiable by theseer/tokenizer[1.1.3].
- theseer/tokenizer 1.1.3 requires ext-dom * -> the requested PHP extension dom is missing from your system.
Problem 12
- aws/aws-sdk-php 3.135.2 requires ext-simplexml * -> the requested PHP extension simplexml is missing from your system.
- league/flysystem-aws-s3-v3 1.0.24 requires aws/aws-sdk-php ^3.0.0 -> satisfiable by aws/aws-sdk-php[3.135.2].
- Installation request for league/flysystem-aws-s3-v3 1.0.24 -> satisfiable by league/flysystem-aws-s3-v3[1.0.24].
To enable extensions, verify that they are enabled in your .ini files:
- /etc/opt/remi/php74/php.ini
- /etc/opt/remi/php74/php.d/20-bz2.ini
- /etc/opt/remi/php74/php.d/20-calendar.ini
- /etc/opt/remi/php74/php.d/20-ctype.ini
- /etc/opt/remi/php74/php.d/20-curl.ini
- /etc/opt/remi/php74/php.d/20-exif.ini
- /etc/opt/remi/php74/php.d/20-fileinfo.ini
- /etc/opt/remi/php74/php.d/20-ftp.ini
- /etc/opt/remi/php74/php.d/20-gettext.ini
- /etc/opt/remi/php74/php.d/20-iconv.ini
- /etc/opt/remi/php74/php.d/20-json.ini
- /etc/opt/remi/php74/php.d/20-phar.ini
- /etc/opt/remi/php74/php.d/20-sockets.ini
- /etc/opt/remi/php74/php.d/20-sodium.ini
- /etc/opt/remi/php74/php.d/20-tokenizer.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
たくさん文字が出てきて驚きました笑
上記のエラーによるとcomposer install時に必要なモジュールがインストールされていなかったようで上記のようなエラーがでております。。。
エラー文のrequires
に続いているものが必要なモジュールの名前になります。そのため、全ての正しいモジュールをインストールしてあげなければなりません。
しかしモジュールをインストールをしているとまたしてもエラー。
ext-simplexml
をインストールしようとするとエラーが発生してしまいます。
[ec2-user@ip-172-31-36-11 laravel]$ sudo yum install --enablerepo=remi ext-simplexml
読み込んだプラグイン:extras_suggestions, langpacks, priorities, update-motd
amzn2-core | 2.4 kB 00:00:00
251 packages excluded due to repository priority protections
エラー: 何もしません
[ec2-user@ip-172-31-36-11 laravel]$ sudo yum install --enablerepo=remi-php74 php-xml
読み込んだプラグイン:extras_suggestions, langpacks, priorities, update-motd
amzn2-core | 2.4 kB 00:00:00
remi-php74 | 3.0 kB 00:00:00
remi-php74/primary_db | 211 kB 00:00:00
246 packages excluded due to repository priority protections
パッケージ php-xml-5.4.16-46.amzn2.0.2.x86_64 はインストール済みか最新バージョンです
何もしません
[ec2-user@ip-172-31-36-11 laravel]$ sudo yum install --enablerepo=remi-php74 unzip
読み込んだプラグイン:extras_suggestions, langpacks, priorities, update-motd
246 packages excluded due to repository priority protections
パッケージ unzip-6.0-20.amzn2.x86_64 はインストール済みか最新バージョンです
何もしません
上記のような感じで結構頑張ったんですがなぜかext-simplexmlが入りません。
そこで下記を実行してみました。
[ec2-user@ip-172-31-36-11 laravel]$ sudo yum --enablerepo=epel,remi,remi-php74 install php74-php-xml.x86_64
読み込んだプラグイン:extras_suggestions, langpacks, priorities, update-motd
301 packages excluded due to repository priority protections
依存性の解決をしています
できたっぽい
つかさず
$ composer install
いけました。simplexmlだけでこんなにもハマるとは思っていませんでした。もし同じ症状で困っている方がいましたら参考にしてみてください。