Server Side Include on plain .htm file on PHP server

I'm trying to help a client setup SSI's on his site. I believe its a Linux host, I don't have access to change any settings though:

Code: <?php include("_head.htm"); ?>

I can't run ASP includes. I can run PHP includes, but only if I give it the PHP file extension. He has dozens of inter-linked pages with the .htm extension. Is there any way to do includes in that case, or are we out of luck? Thank you!
Brad BansnerWeb DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

stu215Systems AnalystCommented:
Assuming its linux you could use an .htaccess file to change the directory permissions to allow SSI commands.

Helpful Link:

Sample .htaccess file :

AddType text/html .shtml
AddHandler server-parsed .htm
AddHandler server-parsed .html
AddHandler server-parsed .shtml
Options Indexes FollowSymLinks Includes
DirectoryIndex index.htm index.html index.shtml index.asp index.php
Options -Indexes

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Brad BansnerWeb DeveloperAuthor Commented:
I made an .htaccess file and put your sample in. Reloaded page:

<!-- #INCLUDE FILE="_head.htm" -->

<p align=center style='margin:0in;margin-bottom:.0001pt;text-align:center'>&nbsp;</p>
  <p align=center style='margin:0in;margin-bottom:.0001pt;text-align:center'><b><span
  style='font-size:13.5pt;color:blue'>Go to the </span><a

So it isn't taking my SSI, or am I not doing this right?
stu215Systems AnalystCommented:
Try the following SSI statement to see if they are working:

<!--#ECHO var="DATE_LOCAL" -->

You may need to use:
<!--#include virtual="_head.htm" -->

Link to Wikipedia abt Virtual vs File for SSI:

Includes the contents of another file or the result of running a CGI script. If the process doesn't have access to read the file or execute the script, the include will fail. "virtual" specifies the target relative to the domain root, while "file" specifies the path relative to the directory of the current file. When using "file" it is forbidden to reference to absolute paths. Higher directories (..) are usually forbidden, unless explicitly configured. The Apache documentation recommends using "virtual" in preference to "file".
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

stu215Systems AnalystCommented:
Other things to check are the permissions on the .htaccess file.
[ The CHMOD of an htaccess file should be 644 or (RW- R-- R--). ]

And:  Uploading files in an FTP program happens in one of three different modes. Auto, Binary and Ascii. When you are uploading an htaccess file, it must be done in Ascii mode. To avoid all of the initial errors, make sure the setting is on Ascii.

Link to info on .htaccess files:
Brad BansnerWeb DeveloperAuthor Commented:
<!--#ECHO var="DATE_LOCAL" --> does work.

Changing to <!--#include virtual="_head.htm" --> does not work.

Reuploaded .htaccess making sure it was ASCII mode.

Not sure what else to do. I don't have access to the server in order to check permissions. If I can't fix this I'll have to resort to making everything .PHP files.
stu215Systems AnalystCommented:
If the Echo statement worked then its probably an issue with the file.

Try putting the path to the file from your server root:
<!--#include virtual="/<some folder>/_head.htm" -->

Make sure the file name is exactly the same...

Not quite sure what else to suggest :-(
Brad BansnerWeb DeveloperAuthor Commented:
Yeah, when I look at the source code of the page, I see this:

<!-- #INCLUDE virtual="_head.htm" --> the web server isn't even processing the include as an include, its just serving that commented out code alongside all the other HTML.
stu215Systems AnalystCommented:
Random thought:
What if you turn on php for your .htm / .html files which would be similar to turning it on with the SSI

and use php includes:
<?php include("header.php"); ?>

Link to info about php includes:
stu215Systems AnalystCommented:
Note: turning on SSI or PHP processing for all your pages creates a lot of overhead processing which can slow down your webserver so neither way is terribly great ...

I think eventually you will want to change them...

-- Doh, forgot you cant change the server settings... forget about the php includes on html files...
stu215Systems AnalystCommented:
If you can download the site to a local linux box or something you could do a search and replace on the whole directory to change things which wouldn't be too bad.

On windows you could use an app such as Dreamweaver CS5 which has nice site management tools and updating features.

Free Trial:
Brad BansnerWeb DeveloperAuthor Commented:
OK, coo. Thanks for all your help!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.