2
JS96
184d

I can't find a complete answer to this question, maybe this community has one:

Does putting an html file, with pure html code (without any php), as .php have any impact (or is processed differently) on the server load compared to simple .html?
Of course, if the content doesn't contain any php code to be processed it doesn't affect the performance, but the simple fact of declaring it as .php cause a different processing root on the server to output the same html result?

I'm aware that if there is any impact, not sure yet, tt's probably negligible, but I'm just curious about the backend root followed.

So, anyone know how exactly these two scenarios are handled (step by step) by the server?
1) Request of pure html as .html.
2) Request of pure html as .php.

My instinct says there must be an additional step in the second scenario to interpret and search for php code to execute.
There is? And does it have any calculatable impact, that multiples for X requests (ignoring caching) and depends of the length of the file?

Thanks

Comments
  • 4
    A software (web server, fpm, whatever) is told that the file contains PHP code. It will parse the PHP file. So yes.

    In order to not have any impact at all, the software must guess with a crystal ball that the file does not actually contain any php tag.

    Edit
    Will the overhead be relevant? I highly doubt. Yet, there must be.
  • 1
    @dmonkey doesn't php have any compilation?
  • 3
    @dmonkey Yeah, thinking longer about it, it makes totally sense, so the question is more about how efficient the php parser is, I guess a lot.

    Thanks for the answer!
  • 2
    @netikras not afaik, at most some caching in a python fashion
  • 2
    @JS96 It could have make some difference 30 years ago. With modern CPUs it's not relevant.
Add Comment