Question PHP include in .shtml pages ( SitePoint Forums PHP ) Updated: 2008-11-23 03:30:01 (13)
PHP include in .shtml pages
Hello
I have a CGI script that generates shtml pages. I want to place php code in there. I have did similar thing with regular html files using htaccess file and it works fine. When I try to parse shtml files using the same technique, it simple downloads the page intead of opening it. Please help.
Answers: PHP include in .shtml pages ( SitePoint Forums PHP )
PHP include in .shtml pages
Do you have .shtml registered as a PHP file type? E.g.
AddType application/x-httpd-php .php .html .shtml
markl999
PHP include in .shtml pages
Thanks for your quick reply. Where can I register it. Can you do it through Cpanel? If so, how?
Seek-n-Pick
PHP include in .shtml pages
I just saw the .htaccess bit you mentioned, you can put the line in there if you like.
markl999
PHP include in .shtml pages
That is the problem. Please go to http://www.seekpick.com. That is what I was talking about, it downloads the page instead of opening it.
Seek-n-Pick
PHP include in .shtml pages
I presume you fixed it now as the .shtml pages load ok?
markl999
PHP include in .shtml pages
Yes, I can't leave it as is. Any suggestions on how to make it work?
Seek-n-Pick
PHP include in .shtml pages
Now i'm lost. It looks fine to me, the .shtml pages are loading normally, or am i missing something?
markl999
PHP include in .shtml pages
Try now
Seek-n-Pick
PHP include in .shtml pages
I must be missing the plot A minute ago .shtml pages worked just fine, now they don't. I thought you wanted .shtml files to work (which they just did) but now they've broke .. what changed to make them break and why did you need to change anything if they did work ok? Sorry if i'm being a bit thick here
markl999
PHP include in .shtml pages
I need to parse shtml pages with php. I tried putting the code you gave me in htaccess file and the problem you see there is the result of it. I had same problem before. My question is, how do I parse them correctly. There has to be some other way or am I missing something?
Seek-n-Pick
PHP include in .shtml pages
Aah, sorry, i'm with it now. Try this in .htaccess:
RemoveHandler .shtml
AddType application/x-httpd-php .shtml
This should stop apache trying to server parse .shtml files and leave them to the php engine.