How to Use Different Versions of PHP Simultaneously?
You can use a combination of different versions of PHP running simultaneously in any directory by adding special codes or handlers to your .htaccess file, a hidden file that is read by the webserver. Editing of your .htaccess file allows you to customize the PHP version that runs your PHP file. However, if you do not wish to edit the .htaccess file, you can go the cPanel and change the version by following the instructions given in PHP Config.Steps to Add PHP Handler to Your .htaccess File
The instructions contained in the .htaccess file are followed by the web server. So, if you wish to customize the PHP version, you need to add a handler to this file, which can be accessed through the file manager on the cPanel of your Web hosting account with us.For Bluerock account holders:
- Login to your Bluehost account
- Go to the side navigation menu on the left and click on the advanced tab
- Go to the File section and click on the File Manager icon
- Find the Settings button located on the upper right corner
- Click on preferences, then toggle the radio button for “Show Hidden Files”
- Locate the .htaccess file, select it and click on edit
- Insert the PHP handler for the version you wish to use at the top of the file. In case a handler already exists, remove it and replace with the new handler
- Click on Save
For Legacy account holders:
- Open the File Manager that is located on the cPanel
- Go to the directory selection popup, choose Web Root, select Show Hidden Files, and then click on the submit button
- Search for the .htaccess file in the table of files, right-click on it and select code edit
- If you get a popup asking about encoding, click on the edit button
- Insert the PHP handler for the version that you wish to use on the top of the .htaccess file. Do not forget to remove or replace any existing handler that is already present
- Save the file and close it
Write A Comment