If you want to update the PHP version applicable to all of your hosting account, you can do it directly in hPanel.
In case you'd like to change the PHP version for only one of your domains, subdomains or a subfolder inside any of these, you can do so by adding a line of code on the .htaccess file:
Step 1 - Open your .htaccess file
First, open File Manager:
Then, access the folder to which you would like to apply a different PHP version. If you want to edit a domain, access its public_html folder. For a subdomain, the corresponding folder will be inside the domain's public_html folder:
For a specific folder, simply go to the desired folder's path. Once in the correct location, open the .htaccess file by double-clicking on it.
If the file doesn't exist, you can create it directly in the File Manager. Make sure to include a dot (.) at the beginning of the filename!
Step 2 - Edit .htaccess file
Add the following code to your .htaccess file (at the very beginning of it):
The second line will define the PHP version for the folder. All you need to do is change application/x-lsphp71 code for the version that you would like to use. Check this table for the possible values:
*PHP versions prior to this one are currently considered outdated and are no longer supported.
To check if the change was applied correctly, you can create a phpinfo.php file
Changing PHP versions using files is not recommended, as it doesn't include PHP extensions and options. Thus, it might affect the website's work