need help to install php 7.2 yum packages on aws ec2

11,974

Solution 1

Although the @amzn-main repo doesn't have PHP 7.2 yet (as far as I know), you can use remi-php72. According to his release blog you can install the EPEL and Remi repositories via:

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
wget http://rpms.remirepo.net/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6.rpm
rpm -Uvh epel-release-latest-6.noarch.rpm

And then enable remi-php72 using yum-config-manager:

yum install yum-utils
yum-config-manager --enable remi-php72

After that, you can simply search and install php and all the needed extensions like normal:

sudo yum install --disablerepo="*" --enablerepo="remi,remi-php72" php php-fpm php-cli ... 

Solution 2

As @Typel says in a comment on the other answer - if you're using Amazon Linux 2 AMI then

sudo amazon-linux-extras install -y php7.2

Beats installing multiple external repos and has most of th basics, including mariadb and vim (everything I need to feel happy!).

See the list: sudo amazon-linux-extras list

Share:
11,974
xeo
Author by

xeo

full stack developer and co-founder of xeodev agency in orlando a startup friendly disruptive tech agency

Updated on June 04, 2022

Comments

  • xeo
    xeo almost 2 years

    I haven't seen any yum packages for php 7.2 on AWS EC2 and the release has been out over a month.

    I have tried yum list | grep php7 and only able see php70 and php71 packages.

    • Has anyone installed php72 on AWS EC2?
    • Is there another yum repo to connect to?
    • Does AWS have a delivery scheduled?
  • xeo
    xeo about 6 years
    thank you! it didn't initially work until i split the rpm line into two individual ones. so i editted your answer with that change.
  • xeo
    xeo about 6 years
    i tried several ways to get this to work. on aws the aws repo takes over for the standard yum install php and i was successfully using yum install php71 but now when i try to yum install php72 i get errors because scl-utils is not installed and this recipe doesn't install or enable scl. i think you're close, but if you can get it running on aws and edit the recipe it would help a lot. thx
  • Jeff
    Jeff about 6 years
    Try sudo yum install --disablerepo=* --enablerepo=remi,remi-php72 php php-fpm php-cli...
  • Typel
    Typel over 5 years
    If you're using Amazon Linux 2 AMI, sudo amazon-linux-extras install -y php7.2
  • Yevgeniy Afanasyev
    Yevgeniy Afanasyev over 5 years
    Error: Package: php72-runtime-1.0-1.el6.remi.x86_64 (remi) Requires: scl-utils Error: Package: environment-modules-3.2.10-0.el6.remi.x86_64 (remi) Requires: libtcl8.5.so()(64bit) Error: Package: php72-runtime-1.0-1.el6.remi.x86_64 (remi) Requires: /usr/sbin/semanage