Thursday , 23 March 2017
Home » .htaccess » [PHP] Runtime Change PHP Version using .htaccess
[PHP] Runtime Change PHP Version using .htaccess

[PHP] Runtime Change PHP Version using .htaccess

Hello Friends,

If you are PHP Developer than you might aware with php versions and theirs functions. If your server have php4 and php5 versions than php4 is the default version. In this case, you are not able to access php5 functions which throws an error while you compare it with local server and live server.

There is an easy way to change php version runtime by using .htaccess. You can switch from php4 to php5 version by using htaccess rule. Just copy and paste below line if you want to change php version from php4 to php5.

AddHandler application/x-httpd-php5 .php .php5 .php4 .php3

Once you put above line, and check phpinfo using phpinfo() function. You can see that php version is changed. It should be php5 version now.

If you face any problem with this, let me know. I would love to help you with any issue you faced.

      
Plugin by: PHP Freelancer

About Rakshit Patel

I am PHP Freelancer, Rakshit Patel working as PHP Programmer India. I have developed this site to share my knowledge, thoughts and experience during the development of projects. We are group of developers working together. If you want to hire us for any PHP related work, you can reach me via Email, Phone or Chat.

One comment

  1. Thanks. I was looking to change the version as i had php4 on my server by default. I want to make it php5 when i execute the script. thanks for sharing. this is exactly what i want.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Notify me of followup comments via e-mail. You can also subscribe without commenting.