Manual modification of PHP version for domains or folders

31 de octubre, 2015 @ 22:06 — 0 comentarios

We've already explained how to modify the PHP version from the Hosting Panel, but there is another way to achive the same and which offer some more flexibility.

In this guide we explain how to manually define the PHP version for a especific domain and/or folder.

1 - Access your hosting using SSH

It's not absolutly necesary to access using SSH, but it's really the easier way. So follow instructions on How to access your hosting via SSH.

2 - Identify the folder

Next step is to identify the root folder of the domain on which you wish to define a different PHP version. You can also choose a subfolder of your wbesite, so you can have a different PHP version on www.yourdomain.com and www.yourdomain.com/newapp.

Once you have identified the desired folder move inside it. For example:

cd public_html/newapp

3 - Open the .htaccess file

There might be or no an .htaccess file on the folder. Anyway, just open it with a text editor such as vim or nano:

nano .htacesss

4 - Enable the desired PHP version

Now you will have to insert one of the following configuration directives in order to enable a specific PHP vesion on the current directory.

 

If you wish to use PHP 7.0:

# Make PHP 7.0 run .php scripts
AddHandler php7.0-script .php

If you wish to use PHP 5.6:

# Make PHP 5.6 run .php scripts
AddHandler php5.6-script .php

If you wish to use PHP 5.5:

# Make PHP 5.5 run .php scripts
AddHandler php5.5-script .php

If you wish to use PHP 5.4:

# Make PHP 5.4 run .php scripts
AddHandler php5.4-script .php

If you wish to use PHP 5.3:

# Make PHP 5.3 run .php scripts
AddHandler php5.3-script .php

 

PHP 5.2 and PHP 4.4

PHP 5.2 and PHP 4.4 still work on our hosting services, but they are not supported and usage must be avoided. If you require PHP 5.2 or 4.4, please contact us.

Etiquetas: