The PHP version is important not only for speed and performance. There are different applications, which may sometimes require specific versions of PHP. With Gubax, all shared hosting customers can define specific versions of PHP for different directories. For example, if you want to run PHP 7.4 on your account, but need to define PHP 7.2 because of your specific application requirements, you can do so by defining custom rules for each of your folders. In this post, we will explain how to run multiple versions of PHP on the same account.
Choosing a PHP version for a specific directory
You can use any combination of different versions of PHP simultaneously in any account directory. Although this is not available using the PHP Selector user interface, it is quite simple to do manually.
To define a different PHP version in your cPanel account, you need to add special code to your htaccess. The htaccess file is a hidden file that is read by the web server. The web server follows all instructions contained in the file. For the purposes of this article, we will explain access via the File Manager in your hosting account's cPanel.
Step 1: Access your domain's cPanel with the information provided in the registered email. If your domain has not been registered or changed the DNS, use the alternate access address.
Step 2: Navigate to the Files → File Manager section. If you want to edit the htaccess file for your primary domain, navigate to the public_html folder. If you need to make any changes to an additional domain, go to the public_html/yourdomain.com folder.
Step 3: When in File Manager, make sure you have "Show hidden files" enabled:

That way, you can see files with a "dot" at the beginning, which are usually hidden by default. The specific file you need in this case is htaccess.
Step 4: To define a customized PHP version for the desired directory, select the htaccess file and click Edit on the top toolbar or right-click and choose the Edit file option:

A pop-up window will appear, where again you will need to click Edit:

Step 5: At the beginning of the file, add the information below (copy and paste to avoid typing errors):
<IfModule mime_module>
AddHandler application/x-httpd-alt-php72___lsphp .php .phtml
</IfModule>
WARNING: note that in this example above, we are using php72 for PHP version 7.2, if you want to use another version such as 5.6 or 7.1, replace it with php56 or php71, respectively.
Getting like this:

Step 6: After adding your own configuration rules, save your changes and close the htaccess file. You should now have your customized version of PHP defined.
If you access the site and you experience a 500 error or the folder tries to download a file. Remove the previous information in the htaccess file and contact our support.