sbswim
sbswim

Reputation: 276

.php vs .html - Why not always use .php?

.html files can translate html and css code. But .php files can do all that an html file can do plus use php. Are there any advantages in using html files over php files, especially in development of a responsive website?

Upvotes: 2

Views: 536

Answers (2)

Christian Gollhardt
Christian Gollhardt

Reputation: 17004

Semantic:

By using *.html/*.htm the reader immediately know, it is just plain HTML

Performance*:

  • Every html file, that is been requested, is sended by the webserver immediately to the browser.

  • For every php file, the webserver first starts the PHP interpreter, which is processing the file. After the file is processed, the output is send to the browser.

This means: html takes less cpu power/memory on your webserver. However you will never realy notice it, if you are not serving thousands of requests per second.

* not as much relavant as it's used to be, due to new caching technologies.

Upvotes: 2

MadeInDreams
MadeInDreams

Reputation: 2126

Php is a Hypertext Processor that work's on server side. It generate content and send it to a browser which reads the content sent by php. Once it is in the client window, the page is fixed. That's why we use JavaScript on client side so the page can work on its own. It is the server that deal with the php file not the browser. You browser only reads markup language like html.

Upvotes: 0

Related Questions