NYCPHP Meetup

NYPHP.org

[nycphp-talk] web page file extensions

Adam Maccabee Trachtenberg adam at trachtenberg.com
Wed Apr 28 11:29:58 EDT 2004


On Wed, 28 Apr 2004, Aaron Fischer wrote:

> I certainly don't want to make a change that will hurt performance as
> this is more of an personal aesthetic issue more than anything else.
> If performance is better given the scenario mentioned, I shall shift my
> current aesthetic preferences.  =)

While it is technically slower to have .htaccess parse all HTML pages
as PHP, I don't believe it should factor into your considerations:

1) If you're on a shared server .htaccess is either already enabled or
   disabled. If it's enabled, you're already taking the performance
   hit regardless whether you map .html to PHP. So, it's essentially a
   "sunk cost."

2) When PHP doesn't find any <?php tags, it just spits out the page
   unmodified. This is a very small performance hit because there's no
   complex logic.

3) People are used to seeing pages in .html and your site should
   prevent leaking internal middleware choices to the user in the form
   of file extensions.

There is a mentality in the software developer community that anything
that impacts performance (or takes up lots of disk space, etc.) is
automatically something to be avoided. We've come a long way from the
1960s: processors are more powerful, hard drives are much larger, RAM
is plentiful. And it's all cheaper than ever.

We've long since passed the inflection point where hardware resources
are more expensive than business objectives and developer costs, yet
we still persist in undervaluing those two assets. Just because
hardware has a tangible price doesn't mean that it's the only part of
the process with a cost.

Finally, I can't believe that anyone whose site is running on a shared
server could ever generate enough traffic that they'd need to worry
whether binding PHP to all .html pages in an .htaccess file would
cause a noticeable slowdown. Check and see.

Okay. Rant over. Thanks for your patience. :)

-adam

-- 
adam at trachtenberg.com
author of o'reilly's php cookbook
avoid the holiday rush, buy your copy today!



More information about the talk mailing list