Why not name all .php files instead of .html

If someone can indicate that I am missing here, it will be appreciated

I am a newbie, but I have not encountered a situation where improper use of an html file in php can be bad.

Perhaps this is just confusion for the developers?

+4
source share
2 answers

PHP files are sent for evaluation after the browser requests them, and HTML files are directly transferred to the browser.

So, if there is no PHP code in your .php file, you still submit it for evaluation, although it does not greatly affect the page load time, if anything.

+7
source

If you have a web server that understands the .php file extension and has the installed PHP module, there is no problem simply renaming the .html file to .php (as long as all links to it are also renamed accordingly).

However, this is of no use (and I would dispute any significant UX benefit from the user's point of view), as this will mean that the web server will need to call the PHP module to parse the file. This will be a waste of time and memory, as it is just a simple HTML file.

+12
source

Source: https://habr.com/ru/post/1491889/


All Articles