yum install php 7.2 amazon linux code example
Example: install php 7.3 on amazon linux 2
sudo yum install -y amazon-linux-extras
sudo amazon-linux-extras | grep php
sudo amazon-linux-extras enable php7.4
sudo yum install php php7.4-{pear,cgi,common,curl,mbstring,gd,mysqlnd,gettext,bcmath,json,xml,fpm,intl,zip,imap}