RE: [PHP] IIS, PHP and HTML
| From: | Tommy Pham | Date: | Thu, 24 Jun 2010 00:34:16 +0000 |
| Subject: | RE: [PHP] IIS, PHP and HTML | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-306390@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Ashley Sheridan [mailto:ash@ashleysheridan.co.uk]
> Sent: Wednesday, June 23, 2010 4:47 PM
> To: Phillip Baker
> Cc: PHP General List
> Subject: Re: [PHP] IIS, PHP and HTML
>
> On Wed, 2010-06-23 at 16:26 -0600, Phillip Baker wrote:
>
> > Greetings All,
> >
> > I am at a new Gig.
> > So this is the existing setup so changing it at least in the short
> > term is not an option.
> >
> > We are in an IIS shop.
> > We have a bunch of files that are html, and in need of php
functionality.
> > And that would be a BUNCH of files.
> >
> > I am interested in setting if I can set up IIS to use the php
> > interpreter on HTML files.
> > And then just start using the html files as php.
> >
> > There are just so many html files I would prefer to not do 301
> > redirects, not header redirects and blot the server with empty files
(nearly
> empty).
> > My preference is to use the existing files.
> >
> > Is there a way to make this happen?
> > Are there any pitfalls in making this happen that I will need to be
> > aware of?
> >
> > Blessed Be
> >
> > Phillip
>
>
> Yes, you just configure IIS to treat the .html extension the same as it
> does .php.
>
> Several things to note though. You can't control this on a site-by-site
basis as
> far as I remember, so if you set this, it's for the whole server. Any
plain html
> pages will be delivered more slowly.
>
Correction, IIS7.5 (Win08r2) and IIS7 (Win08) can set it at per
path/site/server depending on your needs. Set it via 'handler mappings'
accordingly. I don't remember IIS 6 and older since it's been a couple of
years I've dealt with IIS 6.
Regards,
Tommy
> Second, PHP code isn't inserted into HTML, rather it's the other way
around.
> This distinction is important when you are outputting content other than
> HTML from PHP code, or when you are using the header() function.
>
> Although IIS wouldn't be my server of choice, I think the one thing you
may
> find lacking is Apaches .htaccess files. IIS can emulate most of the
behaviour
> of this with plugins though, but I believe they tend to cost.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>