Amazon EC2 :- Not able to downgrade PHP version from 7.4 to 7.2

Viewed 3858

I'm trying to downgrade PHP version from 7.4 to 7.2. This is what did

  1. sudo amazon-linux-extras | grep php and it shows PHP 7.4 as the enabled version.

enter image description here

  1. Disable PHP 7.4 sudo amazon-linux-extras disable php7.4
  2. Enable PHP 7.2 sudo amazon-linux-extras enable php7.2
  3. Installing related modules sudo yum install php php-{pear,cgi,common,curl,mbstring,gd,mysqlnd,gettext,bcmath,json,xml,fpm,intl,zip,imap}
  4. Checking the enabled version again sudo amazon-linux-extras | grep php enter image description here

Now it shows 7.2 as the enabled version.

  1. Restarting httpd systemctl restart httpd.service

After this when I check php -v it still shows 7.4 enter image description here

Can anyone point out what I'm missing.

2 Answers

Reinstalling worked for me.

  1. Uninstall PHP yum -y remove php*

  2. Reinstall PHP and related modules sudo yum install php php-{pear,cgi,common,curl,mbstring,gd,mysqlnd,gettext,bcmath,json,xml,fpm,intl,zip,imap}

Probably your php path variable is not pointed correctly. Please do check the path variable in your centOS configuration once again.

Related