how to change php version in htaccess in server

jeeva picture jeeva · Sep 24, 2012 · Viewed 204.9k times · Source

I'm using php 5.3 on my local machine. On our webserver we have php 4.8. Our server is a shared server. So I want to change the php version on our server via .htaccess file. Is it possible to do it? If yes how to do it?

Answer

APeaze picture APeaze · Feb 7, 2013

To switch to PHP 4.4:

AddHandler application/x-httpd-php4 .php

To switch to PHP 5.0:

AddHandler application/x-httpd-php5 .php

To switch to PHP 5.1:

AddHandler application/x-httpd-php51 .php

To switch to PHP 5.2:

AddHandler application/x-httpd-php52 .php

To switch to PHP 5.3:

AddHandler application/x-httpd-php53 .php

To switch to PHP 5.4:

AddHandler application/x-httpd-php54 .php

To switch to PHP 5.5:

AddHandler application/x-httpd-php55 .php

To switch to PHP 5.6:

AddHandler application/x-httpd-php56 .php

To switch to PHP 7:

AddHandler application/x-httpd-php7 .php

To switch to PHP 7.1:

AddHandler application/x-httpd-php71 .php