PDA

View Full Version : PHP File Extensions


neckbone
01-10-2005, 01:34 AM
Hi Everyone,

I'm a beginner at PHP and would like to ask three questions.

What file extensions do you use for your PHP files?

My web host runs apache server with PHP4 installed. In order to get a file to open, it has to have the filename as such: filename.php4

Should .php4 be used, why isn't .php good enough?

What does the 4 mean?

Thank you.

seobook
01-10-2005, 09:36 AM
I am not much for knowing lots of PHP stuff yet, but I think the newest version of PHP is version 5. I think the 4 stands for the version #. Most php files I see in search results and whatnot just use .php as the extension, but I do not think it probably matters all that much what extension you use.

rustybrick
01-10-2005, 09:55 AM
My company has been using PHP forever. PHP 3 was the last version that required (i believe) you have .php3 as the extension. With PHP 4, you did not need it anymore (I think there were ways around the PHP 3 extension as well). Then we started using PHP 5 for newer sites. We stuck with .php.

I recommend sticking with .php, this way when you upgrade sites to PHP 5 or 6 (when that comes out) you do not have to worry about losing pages in the index.

So go with the simple, .php.

neckbone
01-10-2005, 06:46 PM
Rusty,

I tried to use .php as the extension but it wouldn't work. I contacted the host support and they told me to use .php4 and then everything worked.

I don't want to use .php4 for the reason you said (losing in the index at the next PHP version upgrade).

Now, I don't know what to do short of getting another host.

Connie
01-10-2005, 07:43 PM
I don't use php but I think your host has some problems. I have never seen a
file name extension .php4. IMO that is a crock of S**t. Move to a real web host.

Symbios
01-10-2005, 08:43 PM
If the files don't load with .php on the end then maybe add this to your .htaccess

AddType application/x-httpd-php .php4

or is it

AddType application/x-httpd-php4 .php

If that doesn't work then you are probably not on a linux server and its time to say goodbye to a very bad hosting company.

Mikkel deMib Svendsen
01-10-2005, 08:51 PM
A webserver has to be set up to parse certain files in specific ways. HTML files are usually served right up from file but using dynamic coding like PHP, ASP or ColdFusion files will have to go through a program to translate the server code into a readable HTML output.

In order to perserve resources a webserver is usually set up so it only run the script engine on files where it need to. For ASP it is usually .asp and for PHP it is usually .php - but a webmaster can set it up the way he want. Files that do not have the right extension will not function the way they should.

Apparently your host have chosen the .php4 extension, so if you cannot have them change that then I guess you are stuck with it. And the question is: Why is that a problem?

One thing is for sure: Search engines don't care.

neckbone
01-11-2005, 12:44 AM
One thing is for sure: Search engines don't care.

I believe a search engine would care a lot if the file had to be changed from filename.php4 to filename.php5 or filename.php or filename.whatever if that's what the host decided to do when they upgraded to the next version.

neckbone
01-11-2005, 12:48 AM
If the files don't load with .php on the end then maybe add this to your .htaccess

AddType application/x-httpd-php .php4

or is it

AddType application/x-httpd-php4 .php

If that doesn't work then you are probably not on a linux server and its time to say goodbye to a very bad hosting company.

That might be the thing to do but seems a little messy.