If you are using different types of software on your hosting account, there may be a need to use more than one version of php. For example, maybe the primary website needs php version of 5.2 and an addon domain may use software that requires 5.4.
You can use as many versions of php on your site as you need. Below is a sample of different folders on an account and the different php versions they require.
public_html needs php version 5.2
public_html/addondomain.com needs php version 5.4
public_html/example.com needs php version 5.2
You can use the system default PHP version b adding the following code to your .htaccess file.
You can change the PHP version in any directory you choose. You just need to create a .htaccess file in that directory and enter the appropriate code for your desired PHP version.
If you do not have a php.ini file for the directory you have declared a php version for, the server will attempt to use the system default php.ini. This may cause a newer version of PHP to be used instead of the one you have declared. You will want to set the server to a particular php.ini file. The code samples that follow go into the .htaccess file and define the specific path for the php.ini to be used.
This code tells the server to use the php.ini file located in the public_html folder. This would be for your primary domain name.
To point to an addon domain or other subfolder, you will use code similar to the following...
This method allows you to store a php.ini file that is specific to your version. It is recommended to have a php.ini file for each separate version even if it works with the same file in case you need to make any customizations for that specific instance.
If you wish to use a php.ini file for an older version of php. you can specify the php.ini by using one of the paths below:
If you wish to have a copy of these specific php.ini files in your directories, please contact our Live Support team to have them copy it over for you.
After completing any setup or making any changes, be sure to check and confirm that the settings are correct. You can do this by viewing the settings in a phpinfo page for your directory.
Email: | support@WebHostingHub.com | Ticket: | Submit a Support Ticket |
---|---|---|---|
Call: | 757-416-6627 | Chat: | Click To Chat Now |
We value your feedback!
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
new! - Enter your name and email address above and we will post your feedback in the comments on this page!