Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why not name all files .php instead of .html

Tags:

html

php

If someone could point out what I'm missing here, that would be appreciated

I'm new but I haven't encountered a situation where wrongly naming a html file as php can be bad.

Perhaps it's just less confusing for developers?

like image 658
darkace Avatar asked Dec 01 '22 20:12

darkace


1 Answers

If you've a web server that understands the .php file extension and has the necessary PHP module installed, there's no issue with simply renaming a .html file to .php (as long as all links to it are also renamed accordingly).

However there's absolutely no benefit in doing this (and I'd dispute any meaningful UX benefit from the user's perspective), as it'll mean that the web server will need to invoke the PHP module to parse the file. This will be a waste of time and memory, as it's just a plain HTML file.

like image 83
John Parker Avatar answered Jan 10 '23 16:01

John Parker