LoginSignup
3
3

More than 5 years have passed since last update.

EC2 で nginx + php7.2 環境を構築した時にハマったメモ

Posted at

EC2 で nginx + PHP7.2 の環境を構築していた時にハマったこと。
前提としては rpm とかはあまり詳しくないので、基本 yum だけでサクッと終わらせたい。

まずは nginx
nginx はバージョンのこだわりも特に無いので、さくっと終了

yum install nginx

次に php7.2。
php として 7.2 が動く(「php -v」で7.2となる)ようにしたい。
普通に yum install すると 5.3 になるので、

$ sudo rpm -Uvh ftp://ftp.scientificlinux.org/linux/scientific/6.4/x86_64/updates/fastbugs/scl-utils-20120927-8.el6.x86_64.rpm
$ sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

$ sudo yum install --enablerepo=remi-php72 php-fpm

なのだが、これだと php として 7.2 がインストールされない。

色々調べていたら下記を発見。
https://dev.classmethod.jp/server-side/os/amazonlinux-yum-priority/

どうやら、Amazon Linux の場合はデフォルトでリポジトリの優先度を設定できるプラグインがインストールされているらしい。

なので、/etc/yum.repos.d/amzn-main.repo を

-priority=10
+priority=99

これで解決した。

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3