Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Handlers for a SSIs and php Includes

Status
Not open for further replies.

dodger57

Technical User
Mar 25, 2005
6
US
Hi,

I would like to do the following:

1) be able to use SSIs with the .html extension
2) use php includes in docs with the .html extension

My webhost's tech dept. says it's impossible to do so.

I have no reason to doubt them but thought I would check here in case they were mistaken.

I current have a handler that allows for #1 but when I try to add another, for the php includes, it negates the other.

Thanks for any help with this!
Dodge
 
dodger57,

This seems like a good news/bad news situation.

First, the good news: It can be done. It is possible to modify httpd.conf so that regular HTML files are parsed for both php and ssi, although there would be a performance hit each time a page is served.

Now, the bad news: If you don't have access to modify the httpd.conf file on the server, which would affect all of the content on the host computer, then you can't. If your webhost is unwilling to impose this condition on all users, then you can either move along without it or set up your own hosting.

Out of curiosity, why is it that you need to use both php and ssi in your HTML code?

Wishdiak
A+, Network+, Security+, MCSA: Security 2003
 
Hi Wishdiak,

Thanks for your response. :)

I do not think that our host will be willing to do this so I'll get by as is. It's really not a big deal...just would have made things slightly easier.

The reason I wanted this setup was because I have some menus as text files that I call using SSI (for ease of content changes) and I hate using the shtml extension. That is why I had that particular handler.

Then we recently added a php script for our news page - this scripts requires the use of an include statement - and I have to use the .php extension in order for the includes to work. I didn't want to have to use the .php extension in this case.

Thanks again!
Daf
 
dodger57,

Having given this some more thought, it may be possible to achieve both your goals with some directives in an .htaccess file. I haven't tried this out, but theoretically it should work.

Options +Includes
AddHandler server-parsed .html
AddHandler php-script .html
AddType text/html .html

I'm not certain that both AddHandler directives will be processed, and from your experience it sounds like only one will be.

How difficult would it be to recode your SSI statements in php?

Wishdiak
A+, Network+, Security+, MCSA: Security 2003
 
Thank you for the .htaccess option - I will give it a try. :)

Quote = How difficult would it be to recode your SSI statements in php?

Not that difficult and I may go that route...

If I do decide to convert I can remove the handler for parsing SSIs and add:

AddHandler application/x-httpd-php .htm .html

This would allow for the includes within an .html doc?

Is that correct?

Thanks so much for your time!

Daf
 
dodger57,

Personally, I like the flexibility of php more than perl or ssi. It would certainly solve the problem to parse HTML files for one type of code rather than two.

In my httpd.conf, I have AddType rather than AddHandler:
AddType application/x-httpd-php .htm .html

It looks like either AddHandler or AddType would work to parse HTML files for php.


Wishdiak
A+, Network+, Security+, MCSA: Security 2003
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top