LoginSignup
9
6

More than 1 year has passed since last update.

AmazonLinux2にphp7.4をamazon-linux-extras & yum repositoryのREMIをINSTALL

Last updated at Posted at 2018-10-23

AmazonLinux2のデフォライブラリが古すぎ

sudo su -
yum update
yum install httpd
yum list php*
#5.4.16-45.amzn2.0.6
#古い

Remiから入れる

amazon-linux-extras install epel
#install epel and remi
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

amazon-linux-extras install php7.4
yum-config-manager --enable epel,remi-php74,remi-safe,remi
yum install --enablerepo=epel,remi,remi-php74 php php-mbstring php-gd php-pear

以下php7.2のインストールでコケたときの備忘録

#######以下php7.2のインストールでコケたときの備忘録


yum-config-manager --enable epel,remi-php72,remi-safe,remi
yum install --enablerepo=epel,remi,remi-php72 php php-mbstring php-gd php-soap php-pear php-xml php-pdo php-pgsql php-pecl-zip
#怒られる
#php-pecl-zip-1.15.4-1.el7.remi.7.2.x86_64 (remi-php72)
yum install --disablerepo=amzn2-core --enablerepo=epel,remi,remi-php72 php php-mbstring php-gd php-soap php-pear php-xml php-pdo php-pgsql
#怒られる
#php-cli-7.2.11-1.el7.remi.x86_64 (remi-php72)


バグってるらしい
https://forums.aws.amazon.com/thread.jspa?threadID=270790&tstart=0

php72→remove→php

どうもamzn-coreとremiで競合してるらしいので
php72(amzn-coreのphpに引っかからない)をinstallして依存性解決しつつinstallしたあと
一旦php72をremoveしてamzn-coreを無効化してphpをREMIからinstallする

yum install php72 php72-php php72-php-mbstring php72-php-gd php72-php-soap php72-php-pear php72-php-xml php72-php-pdo php72-php-pgsql
#とりあえずphp72は入るが

php -v
#-bash: php: 
#phpは使えない

#一旦消して
yum -y remove php72*
#REMIのphp72をphpとしてインストール
yum install --disablerepo=amzn2-core php php-mbstring php-gd php-soap php-pear php-xml php-pdo php-pgsql

php -v
#PHP 7.2.11 (cli) (built: Oct 10 2018 10:00:29) ( NTS )
#Copyright (c) 1997-2018 The PHP Group
#Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

#普段使わない使わないrepositoryは止めておく(有効にしとくべきという理論もある)
yum-config-manager --disable remi-php72,remi-safe,remi

libzipを入れる

どうもこいつが主犯らしい

#amzn-coreの方を消す
yum remove libzip
#remiの方から依存解決させる
yum install --enablerepo=epel,remi,remi-php72 php-pecl-zip

9
6
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
9
6