Hi,
I'm learning PHP at a local college.
I've wriiten some files which have a .html.php extension. I'm a little bit confused, are these php files or are they html files. or are they both?
Regards,
Kareem.
php files ?
Moderator: General Moderators
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: php files ?
Filenames may contain multiple periods as a means to organize files by their functionality, but it is the last one that determines the extension.
index.foo.bar.php
index.foo.bar.php
Re: php files ?
A plain HTML file, without any PHP in it, usually is given a file extension of .htm or .html. By default, the file extension .php is given a file that contains any PHP code. This is so the web server can determine whether or not a file needs to be preprocessed by the PHP parser before sending the document to the browser. It is possible to configure the web server to send other extensions to the parser, but ordinarily the dafault is accepted. It would be unusual for a file to be given a combination, such as your post showed.
Re: php files ?
Hi,
Yes I understand that.
Am I right in saying that a pure HTML file can have any extension ( or no extension at all ) and would still work.
Regards,
Kareem
Yes I understand that.
Am I right in saying that a pure HTML file can have any extension ( or no extension at all ) and would still work.
Regards,
Kareem
Re: php files ?
Not really. A web server sends a header that defines what kind of a file it is sending (a web page, a multimedia file, a file to be downloaded, etc.) and if it doesn't recognize the kind of file it is asked to send, it cannot create the appropriate header. Generally, web pages (that is, HTML protocol) are given extensions of .htm or .html. It would be possible to configure a server otherwise, but there's little reason to ever do so.
Re: php files ?
Hi,
So if a file contained php code and html code, what extension would the file have. would it be .php or .html
So if a file contained php code and html code, what extension would the file have. would it be .php or .html
Re: php files ?
Go back and read the second sentence of my first reply.kareem100 wrote:Hi,
So if a file contained php code and html code, what extension would the file have. would it be .php or .html