Under PHP Manager in cPanel you can change the PHP version for the entire hosting account or for a specific directory.
Below you can read how to set a different PHP version for a specific directory (website) of your hosting account.
Choosing a PHP Version (FastCGI) for a Specific Directory
You can enable a different PHP version for a certain directory (website) in two easy steps.
You first need to access "Set the PHP version for a particular directory" section under PHP Manager in cPanel.
From the options there you have to select the PHP version (1) and enter the desired directory (2). Finish the setup by clicking the Add button (3).
You need to create an .htaccess file or edit the existing one, located in the same directory. Afterwards, you should add the following lines to the file:
<IfModule mod_fcgid.c> AddHandler fcgid-script .php FcgidWrapper /home/cpuser/dir/php.fcgi .php </IfModule>
You can copy these lines directly from the PHP manager after adding the system files to the desired directory.
After saving the changes in the .htaccess file, the selected PHP version will be enabled for the specified directory. You can check the PHP version that is enabled for the directory by placing a PHP file with phpinfo().
After activating the PHP version, the two files - php.fcgi and phpXX-fcgi.ini - will be automatically added to the directory. You can use phpXX-fcgi.ini to edit PHP directives. In addition, a separate phpXX.ini configuration file is created, which is used only to manage PHP modules. This file can be found in the hosting account, in the directory:
phpXX - replace with the version of PHP;