Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

running php on .shtml pages

can you do php and server side includes on the same page

7:31 pm on Oct 21, 2004 (gmt 0)

Full Member

joined:Jan 31, 2004
votes: 0

I need to make some changes on a site but they use .shtml pages and have an elaberate include system they use. I have php I need to add to the page. I know I could just use php includes but that would be a lot of work to switch over the way they have it.

I'm thinking it is one or the other. Normaly if it is .html i just change the .htacces file to run .html files through the php engine.

9:24 pm on Oct 21, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 20, 2004
votes: 0

You CAN use .htaccess to run .shtml files through the PHP parser. Not much of an issue, except as follows:

Apache will parse a .shtml file then send it through PHP (or the other way around), as opposed to just using the one parser, so there's a little extra server overhead involved. If your site is not >500,000 hits-per-day busy, you shouldn't worry about the extra overhead.

9:55 pm on Oct 21, 2004 (gmt 0)

New User

10+ Year Member

joined:Feb 24, 2004
votes: 0

I've seen this question answered in another forum. I thought it might come in handy someday so I saved it.

I haven't tested it, but it's just a mime code added to the html page. Here it is:

<MIME TYPE Extension application/x-httpd-php.html>


<MIME TYPE Extension application/x-httpd-php .html>

The difference in the two is the second one has a space after php. I'm not sure which is correct. Like I said, I haven't tested this out yet.

10:26 pm on Oct 21, 2004 (gmt 0)


WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
votes: 3