views:

60

answers:

1

On a standard LAMP stack, do .php files without any PHP in them get passed to the PHP interpreter?

In other words, is there a performance/processing loss for creating a .php file without actually including any PHP in it, versus just making it a .html file?

+9  A: 

On a standard LAMP stack, do .php files without any PHP in them get passed to the PHP interpreter?

Yup - after all, no other component except for the PHP parser is fit to decide whether the file contains PHP!

In other words, is there a performance/processing loss for creating a .php file without actually including any PHP in it, versus just making it a .html file?

Potentially, yes, although it will be minimal in most cases unless you have really, really loads of traffic.

Pekka
I agree that the performance loss for processing a php file without php-content probably is minimal, but what cache-headers does it set? The whole idea with php is to create dynamic pages, so I don't expect to find a cache-header far into the future on php files (unless it is specifically set inside the php file). Therefore I assume that a php file without any php-statements will be fetched every time and not cached.
some
@some that will depend on the server's default settings for the file type... But it's indeed a good point. It's advisable to look for what headers are sent
Pekka