In order to change the PHP version, you need to make the following changes from the cPanel:
Login to the cPanel of the domain name for which you wish to switch the PHP version.
Click on Select PHP Version under Software and Services section.
Select the required PHP version from the drop-down list and click on Set as current.
You can configure the server to use different PHP versions on your subdomains and directories by adding the SetHandler code in the .htaccess file of the folder to override the default PHP version.
For example, your website www.yourdomainname.com requires PHP version 5.6 and the application on your website which is stored at www.yourdomainname.com/application requires PHP version 7.0 to execute, follow these steps to configure the PHP versions for your subdomains or directories.
Configure PHP Version.
1. Navigate to the directory for which you want to use a different PHP version.
2. Open the .htaccess file. If you don't see the file try enabling hidden files from settings or create a .htaccess file.
3. Add this code to the file.
Depending on the version you want to use, modify the SetHandler line in the code.
PHP Version 5.1 - application/x-lsphp51
PHP Version 5.2 - application/x-lsphp52
PHP Version 5.3 - application/x-lsphp53
PHP Version 5.4 - application/x-lsphp54
PHP Version 5.5 - application/x-lsphp55
PHP Version 5.6 - application/x-lsphp56
PHP Version 7.0 - application/x-lsphp70
PHP Version 7.1 - application/x-lsphp71
Example: If you want the folder to use PHP version 7.1 add the following code to /home/user/public_html/subfolder/.htaccess