Use htaccess to Manage your PHP File Extensions

Your rating: None Average: 1 (2 votes)

I have been using Godaddy share hosting for a while now with no problems. But things start getting a little shaky when I decided to give Joomla and Drupal (a powerful CSM) open source software a try to replace my WordPress blog.

The problems was due to the fact that by default, files with a .php extension run under PHP 4 and files with the .php5 extension run under PHP 5. So I needed to modify my .htaccess to run PHP5 all the time. The .htaccess file, located at the root of your site, can be used to change these default settings. The following entries in a directory's .htaccess file designate .php files to run under PHP 5 and .php4 files to run under PHP 4.

To run your website using php5 then all what you need to do is add the follow code to your .htaccess file.

AddHandler x-httpd-php5 .php
AddHandler x-httpd-php .php4

According to Godaddy changes made to an existing .htaccess file will be seen immediately. When a new .htaccess file is created or an existing .htaccess file is deleted, however, these changes will not be seen until the htaccess cache is cleared. This occurs every hour.

Please try to help out with unanswered topics on the forum. Chances are you have had the same issue/question some time in your IT career!

Comments

Have a question? Please ask it on the forum instead.
Jason's picture
Jason (not verified)
Re: Use htaccess to Manage your PHP File Extensions

Brilliant. Exactly what I needed to **fix** GoDaddy. I'm rockin' now!

ForexSum's picture
ForexSum (not verified)
Great post. Gives me what I have been looking for.

I really like your post. Does it copyright protected?

Post new comment

CAPTCHA
The question below is to prevent automated spam submissions.
2 + 7 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.