Cpanel Apache Handlers

liunx

Guest
If you look under apache handlers you see that SHTML pages are capable of hadling Includes (which is how I do mine). You can also set it up so that .html and .htm pages can handle includes. Is there a down side to doing this? It sure seems easy to stick with html instead of PHP or SHTML.<!--content-->
Don't know if there is a downside. I thought I read a while back on the forums that someone couldn't mix SHTML and PHP. However you can use PHP includes to do everything you are doing now and it works in HTML files just fine.<!--content-->
So the main page can be in HTML and the include is a PHP file? Is that how it works or visa-versa<!--content-->
That is correct. Take a look at the <a href="http://us3.php.net/function.include" target="_blank">manual</a> for the include function.<br /><br />My site is all HTML and I use PHP includes for navigation and footers.<!--content-->
Ok, so I tried making an html page with a php include but I am having problems. <br /><a href="http://myjensen.com/new.html" target="_blank">http://myjensen.com/new.html</a><br />if you look at the source it shows three different attempts at getting it, but none show up. any Ideas?<!--content-->
<!--QuoteBegin-wampthing+May 28 2005, 07:11 AM--><div class='quotetop'>QUOTE(wampthing @ May 28 2005, 07:11 AM)</div><div class='quotemain'><!--QuoteEBegin-->If you look under apache handlers you see that SHTML pages are capable of hadling Includes (which is how I do mine).  You can also set it up so that .html and .htm pages can handle includes.  Is there a down side to doing this?  It sure seems easy to stick with html instead of PHP or SHTML.<br /><div align="right"><a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=132548"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><!--QuoteEnd--></div><!--QuoteEEnd--><br />The Apache manual recommends against configuring the server to parse .html and .htm pages for server-side includes:<br /><!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->...by doing this, you're requiring that Apache read through every single file that it sends out to clients, even if they don't contain any SSI directives. This can slow things down quite a bit, and is not a good idea.<!--QuoteEnd--></div><!--QuoteEEnd--><br />What is recommended instead is to use the XBitHack directive in your .htaccess file:<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->XBitHack on<!--c2--></div><!--ec2--><br />With XBitHack enabled in your .htaccess file, you can have specific .html pages parsed for server-side includes by setting the permissions on those files to be executable.<!--content-->
WOW, Talk about pealing an onion. <br />Ill see if I can figure it out.<!--content-->
Sorry, missed one critical piece of information. For PHP to be parsed in HTML pages you need to add this to your .htaccess file.<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->AddType application/x-httpd-php .htm .html<!--c2--></div><!--ec2--><!--content-->
<!--QuoteBegin-TCH-Bruce+May 28 2005, 08:48 AM--><div class='quotetop'>QUOTE(TCH-Bruce @ May 28 2005, 08:48 AM)</div><div class='quotemain'><!--QuoteEBegin-->Sorry, missed one critical piece of information.  For PHP to be parsed in HTML pages you need to add this to your .htaccess file.<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->AddType application/x-httpd-php .htm .html<!--c2--></div><!--ec2--><br /><div align="right"><a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=132559"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><!--QuoteEnd--></div><!--QuoteEEnd--><br />OK I added the code to my .htaccess file, and now instead of getting nothing I get errors. <br />Any Ideas?<!--content-->
I use Bruces method above<br />as all my html pages are made up of php includes.<br />I also added shtml to the list so my error pages can use php.<br />However SSI will no longer work in the error pages,<br />but I do not care as I use php instead.<!--content-->
How are you including?<br />include("file");<br />or<br />include $_SERVER['DOCUMENT_ROOT']."/file";<!--content-->
I have tried <!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><!--#include file="/pool/top.php" --><!--c2--></div><!--ec2--><br />and<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><!--#include virtual="/pool/top.php" --><!--c2--></div><!--ec2--><br />and<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><?php include("/pool/top.php"); ?><!--c2--></div><!--ec2--><!--content-->
try<br />include $_SERVER['DOCUMENT_ROOT']."/pool/top.php";<!--content-->
I have tried it all of the following ways<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><body><br />include $_SERVER['DOCUMENT_ROOT']."/pool/top.php"<br /><!--#include file="/pool/top.php" --><br /><?php include("/pool/top.php"); ?><br /><!--#include virtual="/pool/top.php" --><br /><br /></body><!--c2--></div><!--ec2--><br />no luck<!--content-->
Ok remove the SSI<br />and add a ; after the include<br /><br /><body><br /><?php include $_SERVER['DOCUMENT_ROOT']."/pool/top.php"; ?><br /><br /></body><!--content-->
thanks everyone. got it working.<!--content-->
<img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/kicking.gif" style="vertical-align:middle" emoid=":dance:" border="0" alt="kicking.gif" /> Looks good <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/clapping.gif" style="vertical-align:middle" emoid=":clapping:" border="0" alt="clapping.gif" /> <br /><br />Now the fun begins <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /><!--content-->
Great, glad you got it sorted out. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/clapping.gif" style="vertical-align:middle" emoid=":clapping:" border="0" alt="clapping.gif" /><!--content-->
 
Back
Top