Install PHP 7 series on Amazon Linux 2 with Amazon Linux Extras

I can't install PHP7 on Amazon Linux2! !! ?? ??

Until 30 minutes before writing this article, I was fighting the console halfway.

For some reason, when I tried to install the remi version of PHP 7.1, no matter how many times I hit it

language:error:


Error: Package: php-xml-7.1.33-10.el7.remi.x86_64 (remi-php71)
           Requires: libxslt.so.1(LIBXML2_1.0.22)(64bit)
Error: Package: php-xml-7.1.33-10.el7.remi.x86_64 (remi-php71)
           Requires: libxslt.so.1(LIBXML2_1.0.18)(64bit)

I got a feeling that the installation did not proceed at all, I wondered if I couldn't install it because I didn't have enough related packages, so I searched and tried various things. "I can't install it because it's already new and used for other things." Something like that came out ** Head eruption. ** **

Helping hand

After several installation failures, the following answer came back from AL2.

php-fpm is available in Amazon Linux Extra topics "php7.2" and "lamp-mariadb10.2-php7.2" and "php7.3" and "php7.4"

To use, run
$ sudo amazon-linux-extras install :topic:

Learn more at
https://aws.amazon.com/amazon-linux-2/faqs/#Amazon_Linux_Extras

[wrap up] If you use php7.2 in the dependent package, you can use it with ** amazon-linux-extras **. Hit the amazon-linux-extras command. See the documentation (https://aws.amazon.com/amazon-linux-2/faqs/#Amazon_Linux_Extras) for more information.

What is Amazon Linux Extras! ??

It's like a standard package on CentOS. It will be supported for a long time until June 30, 2023, when ** Amazon Linux is no longer supported. ** **

You can see a list of packages available in $ amazon-linux-extras list. I'm happy to be able to use php7.2-7.4! Initially I tried to put it in 7.1, but I decided to put it in because 7.2 was fine.

$ sudo amazon-linux-extras list
  0  ansible2                 available    \
        [ =2.4.2  =2.4.6  =2.8  =stable ]
  2  httpd_modules            available    [ =1.0  =stable ]
  3  memcached1.5             available    \
        [ =1.5.1  =1.5.16  =1.5.17 ]
  5  postgresql9.6            available    \
        [ =9.6.6  =9.6.8  =stable ]
  6  postgresql10             available    [ =10  =stable ]
  8  redis4.0                 available    \
        [ =4.0.5  =4.0.10  =stable ]
  9  R3.4                     available    [ =3.4.3  =stable ]
 10  rust1                    available    \
        [ =1.22.1  =1.26.0  =1.26.1  =1.27.2  =1.31.0  =1.38.0
          =stable ]
 11  vim                      available    [ =8.0  =stable ]
 15  php7.2                   available    \
        [ =7.2.0  =7.2.4  =7.2.5  =7.2.8  =7.2.11  =7.2.13  =7.2.14
          =7.2.16  =7.2.17  =7.2.19  =7.2.21  =7.2.22  =7.2.23
          =7.2.24  =7.2.26  =stable ]
 17  lamp-mariadb10.2-php7.2  available    \
        [ =10.2.10_7.2.0  =10.2.10_7.2.4  =10.2.10_7.2.5
          =10.2.10_7.2.8  =10.2.10_7.2.11  =10.2.10_7.2.13
          =10.2.10_7.2.14  =10.2.10_7.2.16  =10.2.10_7.2.17
          =10.2.10_7.2.19  =10.2.10_7.2.22  =10.2.10_7.2.23
          =10.2.10_7.2.24  =stable ]
 18  libreoffice              available    \
        [ =5.0.6.2_15  =5.3.6.1  =stable ]
 19  gimp                     available    [ =2.8.22 ]
 20  docker=latest            enabled      \
        [ =17.12.1  =18.03.1  =18.06.1  =18.09.9  =stable ]
 21  mate-desktop1.x          available    \
        [ =1.19.0  =1.20.0  =stable ]
 22  GraphicsMagick1.3        available    \
        [ =1.3.29  =1.3.32  =1.3.34  =stable ]
 23  tomcat8.5                available    \
        [ =8.5.31  =8.5.32  =8.5.38  =8.5.40  =8.5.42  =8.5.50
          =stable ]
 24  epel                     available    [ =7.11  =stable ]
 25  testing                  available    [ =1.0  =stable ]
 26  ecs                      available    [ =stable ]
 27  corretto8                available    \
        [ =1.8.0_192  =1.8.0_202  =1.8.0_212  =1.8.0_222  =1.8.0_232
          =1.8.0_242  =stable ]
 28  firecracker              available    [ =0.11  =stable ]
 29  golang1.11               available    \
        [ =1.11.3  =1.11.11  =1.11.13  =stable ]
 30  squid4                   available    [ =4  =stable ]
 31  php7.3                   available    \
        [ =7.3.2  =7.3.3  =7.3.4  =7.3.6  =7.3.8  =7.3.9  =7.3.10
          =7.3.11  =7.3.13  =stable ]
 32  lustre2.10               available    \
        [ =2.10.5  =2.10.8  =stable ]
 33  java-openjdk11           available    [ =11  =stable ]
 34  lynis                    available    [ =stable ]
 35  kernel-ng                available    [ =stable ]
 36  BCC                      available    [ =0.x  =stable ]
 37  mono                     available    [ =5.x  =stable ]
 38  nginx1                   available    [ =stable ]
 39  ruby2.6                  available    [ =2.6  =stable ]
 40  mock                     available    [ =stable ]
 41  postgresql11             available    [ =11  =stable ]
 42  php7.4                   available    [ =stable ]
 43  livepatch                available    [ =stable ]
 44  python3.8                available    [ =stable ]
 45  haproxy2                 available    [ =stable ]
 46  collectd                 available    [ =stable ]
 47  aws-nitro-enclaves-cli   available    [ =stable ]
 48  R4                       available    [ =stable ]

Practice

php7.2 installation

$ sudo amazon-linux-extras install php7.2
~
Installed:
  php-cli.x86_64 0:7.2.34-1.amzn2 php-fpm.x86_64 0:7.2.34-1.amzn2 php-json.x86_64 0:7.2.34-1.amzn2 php-mysqlnd.x86_64 0:7.2.34-1.amzn2
  php-pdo.x86_64 0:7.2.34-1.amzn2

Dependency Installed:
  libzip5.x86_64 0:1.7.3-1.el7.remi                                  php-common.x86_64 0:7.2.34-1.amzn2

Complete!

php version check

$ php -v
PHP 7.2.34 (cli) (built: Oct 21 2020 18:03:20) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

** It ended in an instant? ** **

Impressions

Knowing this, I didn't have to put in or install extra repositories to pollute my instance. .. We provide it on the basic CentOS, but if Amazon Linux has wider middleware support, This may be better ... PHP that is not the OS standard is also released as a special support, but it will expire in 2 years of support.

Recommended Posts

Install PHP 7 series on Amazon Linux 2 with Amazon Linux Extras
Install tomcat 5.5 on Amazon Linux.
Install strongSwan 5.9.1 on Amazon Linux 2
Install Python Pillow on Amazon Linux
Install oracle java8 on amazon linux2
Install pyenv on EC2 (Amazon Linux)
[Note] Install Imagick on Amazon Linux2
I'll install Ruby on EC2 (Amazon Linux2) 2020
How to update php on Amazon linux 2
How to install Anisble on Amazon Linux 2
Install Mecab on Linux (CentOS) with brew
How to install php7.4 on Linux (Ubuntu)
Install Python 3.8, Pip 3.8 on EC2 (Amazon Linux 2)
Compile and install MySQL-python for python2.7 on amazon linux
[AWS EC2] How to install Maven on Amazon Linux 2
Install Minecraft on Arch Linux
Install Linux on your Chromebox
Install the JDK on Linux
Put jenv on Amazon Linux
Install Chrome on CentOS 7 series
Use sshpass on Amazon linux2
Prepare pipenv environment with amazon Linux 2
Try installing OpenAM on Amazon Linux
Install CUDA on Linux Mint Mate 20
How to install wkhtmltopdf (Amazon Linux2)
Install pyStruct on MacOSX10.11 with macports
[Note] Run Django on Amazon Linux 2
Run docker-compose on Amazon Linux2 on ARM64
Introduce Python 3.5.2 environment on Amazon Linux
Install python2.x on catalina with pyenv
Run cron on Amazon Linux (set on Linux)
Summary of installing PHP7.2 on EC2 (Amazon Linux 2) and setting php.ini
Create a Docker container image with JRE8 / JDK8 on Amazon Linux
Install scipy on Linux without internet connection
Building a Python3 environment with Amazon Linux2
Procedure for building a kube environment on amazon linux2 (aws) ~ (with bonus)
How to install aws-session-manager-plugin on Manajro Linux
Install wsl2 and master linux on windows
Use Numpy, Scipy, scikit-learn on Amazon Linux
A story I was addicted to trying to install LightFM on Amazon Linux
X86 assembler on Linux (linkage with C)
Data integration from Python app on Linux to Amazon Redshift with ODBC
[C] [python] Read with AquesTalk on Linux
Install and launch k3s on Manjaro Linux
Build an LNPP environment on Amazon Linux 2
Install and Configure TigerVNC server on Linux
scipy stumbles with pip install on python 2.7.8
Learn sshd_config and authorized_keys (on Amazon Linux 2)
Upgraded mysql on Cloud9 (Amazon Linux) (5.5 to 5,7)
How to install packages on Alpine Linux
5 reasons to install Linux on your laptop.
Dockerfile: Install Docker on your Linux server
Run a batch of Python 2.7 with nohup on Amazon Linux AMI on EC2
Run Keycloak on Amazon Linux 2 without Docker
Install rJava on Linux in R3.6 environment.
[Amazon Linux] Switching from Python 2 series to Python 3 series
Until you install Arch Linux on VMware
Linux "Install on / dev / sda" error resolution
Install Python3 and Django on Amazon Linux (EC2) and run your web server
Run Linux on ARM architecture with QEMU
[Linux] Build a Docker environment with Amazon Linux 2