We can change the PHP version by CPanel > Select PHP version or by setting at .htaccess file
When we change the PHP version with CPanel - the domain and sub-domain will effected
But if we change PHP version with .htaccess file, only that domain will effected
So which one should we choose?. It depend to the need of every website. For example we have 3 website & let say 2 website is a latest version & need php 7.2 and higher but the 3 website is need lower php version. So, in this case - for the website that need the lower php version, we have to setting it with .htaccess file.
To do that - we need to add the following line as below.
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “alt-php70” package as the default “PHP” programming language.
AddHandler application/x-httpd-alt-php70 .php .php7 .phtml
# php -- END cPanel-generated handler, do not edit
Likewise, for example for the next time we want to change the setting only using the Cpanel - so we just delete that line from .htaccess file