Best Server Hosting & Managed IT Company Since 2016

How to Set the PHP Version per Folder?

Do you have a single domain or wish to use а different PHP version per folder? Do you have an installed PHP 5.x software in a folder/blog and want to use a PHP 7.x instead? If so, you can do this using cPanel and the .htaccess file.

1. Log into your cPanel account.
2. In the “Software” section, click on the “MultiPHP Manager” icon.

cpanel multiphp icon - How to Set the PHP Version per Folder?

3. Assume that we are new to this and the first thing we will need to do is to get the code generated by cPanel.
4. Scroll down to the end of page, select your domain from the left side and you will see the option “PHP Version” with a drop-down list on the right side. Select the appropriate PHP version from the drop-down menu and click the Apply button.

cpanel multiphp select domain full - How to Set the PHP Version per Folder?

5. Now open the /public_html/.htaccess file in the cPanel File Manager or in your FTP client and you will find the code generated by cPanel.

cpanel multiphp version generated - How to Set the PHP Version per Folder?

6. After you copy the code, you will wish to set the PHP version to version 7 in the folder/forum, which means you will need to create a .htaccess file in the folder /forum/ and paste the code which was generated in the previous step in it.

7. Congratulations, now your folder/forum uses PHP 7, and if you wish to set any other folder to use the same version of PHP as well, you will only need to copy the code from the .htaccess file and paste it into that folder.

Reset your PHP version from your main domain. If you wish to use a different PHP version on any folder, you will need to follow steps 5 and 6, generate the code, copy that code from /public_html/.htaccess and paste it into any folder where you wish to set your selected PHP version.

About the Author
Medha Hosting
Medha Hosting is the leading global Cloud, Managed hosting and managed IT services provider with award winning platforms in USA, Europe and Asia. Medha Hosting have delivered enterprise-level hosting services to businesses of all sizes round the world since 2014 and still serve a growing base of customers. They relay heavily on our 100 percent up time guarantee, unbeatable level of client service through our triumph Support Heroes, and world reach with half-dozen data centers across five regions in Europe, US, and Asia.we have a tendency to integrate the industry’s best technology to supply you better of breed cloud hosting solutions, all backed by our triumph Support Heroes.

Leave a Reply