1. ICX | Knowledge Base
  2. Adobe Commerce (Magento)
  3. Magento Administration and configuration

How to change PHP version?

In case you need to change the PHP verison of the server

To change the version, just copy and paste these commands:

PHP from 7.2 -> 7.4
sudo a2dismod php7.2
sudo a2enmod php7.4
sudo service apache2 restart
sudo update-alternatives --set php /usr/bin/php7.4

PHP from 7.4 -> 7.2

sudo a2dismod php7.4
sudo a2enmod php7.2
sudo service apache2 restart
sudo update-alternatives --set php /usr/bin/php7.2

After using the commands your PHP version inside the server should change successfully.

Felipe Hidalgo.