Downgrade php Version using Htaccess

There may some times that your site starts behaving like your ex girlfriend, totally weirdo.

You would almost spend days over to investigate the problem

  • Check Error Log
  • Debug all code
  • Remove modules
  • Restart Server
  • Fight with Hosting Company
  • Check Access Log
  • Follow net tutorials
  • Screw the current installation
  • Upgrade the installation
  • Hire a Freelancer (Last resort)

htaccess-book-01[1]

 

Now Here is a quick solution to check if problem is caused because of PHP version change by your hosting.

Create a file say phpinfo_xyz.php

add following code to it


<?php phpinfo(); ?>

upload it to your domain so it reads like

http://yoursite.com/phpinfo_xyz.php

Run this url in your browser and note your current version of PHP.

You can downgrade your PHP version of a directory using .htaccess file

Here is a sample command

AddHandler x-httpd-php5-3 .php
AddHandler application/x-httpd-php5 .php

Add above lines in your folders .htaccess file and see the change

By again running

http://yoursite.com/phpinfo_xyz.php

You can see if your site version is changed, and see your site for performing better.

Same situation happened to me when I shifted my server from

PHP V5.3 to PHP V5.4

My site was using Opencart V1.5.x so finally i planned to downgrade my site to PHP V5.3, and it worked smoothly.

Send your questions in comments

 

Downgrade php Version using Htaccess

Leave a Reply

Your email address will not be published.