How to change the version of PHP

This tutorial shows you how you can change the version of PHP. You can use different versions for different directories of your shared Linux hosting account. 

First you need to check the current PHP version. You have to create a file called "phpinfo.php" (or named in a different way) and enter the following code in it: 

<?php
phpinfo();
?>

Then you have to upload the file to the directory whose version of PHP you are going to check. Then you have to open the file so that the code gets executed. If the upload directory is the DocumentRoot of your domain, the URL is the following: 

http://mydomain.com/phpinfo.php

The page would tell you the version of PHP as well as additional information about the imprementation of PHP. 

In order to change the version you have to insert one of the following lines in the file ".htaccess": 

PHP 4: AddHandler application/x-httpd-php4 .php
PHP 5: AddHandler application/x-httpd-php5 .php .php5 .php4 .php3
PHP 5.1: AddHandler application/x-httpd-php51 .php .php5 .php4 .php3
PHP 5.2: AddHandler application/x-httpd-php52 .php
PHP 5.2(Suhosin patch): AddHandler application/x-httpd-php52s .php .php5 .php4 .php3
PHP 5.3: AddHandler application/x-httpd-php53 .php
PHP 5.4: AddHandler application/x-httpd-php54 .php
PHP 5.5: AddHandler application/x-httpd-php55 .php
PHP 5.6: AddHandler application/x-httpd-php56 .php .php5 .php4 .php3
PHP 7: AddHandler application/x-httpd-php70 .php .php5 .php4 .php3

The file ".htaccess" affects the directory it is located in as well as its subdirectories. 

I you have questions you can always contact the FriendlyGeeks technical support team: our email is "support@icn.bg" and our telephone number is "02 491 8877" and "+359 888 738338".

Публикувано на

В случай, че имате нужда от техническа помощ или по-детайлна информация свързана с темата от помощната статия, молим да изпратите запитване.

Пусни запитване

Нашият Friendly Geeks техничеки екип с радост ще Ви съдейства денонощно и на:

  • Национален телефон: 0700 300 70 (на цената на един градски разговор)
  • Тел.: +359 2 491 8877