Re: Newbie Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jan 2, 2011 at 12:16 PM, Ashley Sheridan
<ash@xxxxxxxxxxxxxxxxxxxx>wrote:

> On Sun, 2011-01-02 at 11:48 -0500, admin@xxxxxxxxxxxxxxxxxxx wrote:
>
> > Add this to your .htaccess file and HTML files will be handled like PHP
> > files allowing you put PHP in HTML files.
> >
> > AddType application/x-httpd-php .html
> >
> >
>
I wouldn't recommend having .html parsed as PHP though, as it will slow
> down your website/application unnecessarily for any .html files that
> contain no PHP code, as PHP still has to parse the file for any code,
> even if there is none. Leave .html files for static pages that you
> produce with a PHP app for example, or use MOD_REWRITE to reference PHP
> scripts when certain .html files are requested by the browser, as this
> can be a whole lot more specific and selective and won't introduce
> problems later on.
>


I tend to disagree with Ashley on this topic.  For many websites, I'll start
out making all pages .php, even if they don't require PHP at the moment.
 That's for a couple reasons.

1) A few years back, there was certainly a significant performance advantage
to keeping essentially static pages html.  However, in my current
benchmarking (using both siege and ab on my Ubuntu servers using apache with
mod_php), if I use a cache such as APC and a well-configured apache server,
PHP tends to perform just as well (or sometimes even better) than the html
version.

Rasmus has demonstrated similar performance results:
http://talks.php.net/show/froscon08/24

2) I don't want to have to change urls site-wide and set up redirects from
the old url whenever a page requires adding dynamic capabilities.  By making
all pages PHP right from the beginning, adding dynamic capabilities is a
snap as I just add the functionality.

Adam

-- 
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux