Forum Moderators: phranque
I've read about a price against performance, but haven't been able to learn anything firm about that. What are my options?
As it pertains to this scenario, the differecnce is:
SSI - the server parses each page in your domain looking for the SSI, even if there is none.
PHP - the server responds to the PHP include tag, if/when they occure.
Do I have any options beside the Handler in the .htaccess? If not, what is the likely downside on performance? The site is necessarily image heavy, so I hate to give up more in this area. But I have to add includes ASAP. This site was never supposed to do so well.
Should I go to .shtml or .php for future pages? The site is steadily expanding.
Your URLs need not have any relationship to the names of their content files, as long as you have the correct handlers and MIME-types configured. You can use mod_rewrite to map .html URLs to .php or .shtml files any way you like.
XBitHack allows you to control SSI parsing and provide Last-Modified headers with finer control than AddHandler. The downside is that XBitHack is controlled by the files' execution permission bits, and so you must be careful to set those bits on all new files uploaded to your server. If these bits get reset, the pages won't be parsed for SSI and won't return correct Last-Modified headers. Using AddHandler, the files will always be parsed for SSI, but you'd still need to use XBitHack to control the Last-Modified headers. At least it's truthfully labeled "XBitHack.
Jim
Is there any way to use PHP includes without the .php extension?
In .htaccess:
AddHandler application/x-httpd-php .php .html
In mark-up:
<?php include("directory/file_name.html");?>
The server has to parse files if you use either SSI or PHP, so that's a wash.
Yes Jim, but instead of parsing every HTML document for SSI before it is given to the browser which does slow things a little, I've found using PHP includes is much faster because only pages are parsed if they contain the PHP include. Of course, I may be wrong on this ;)
Pages must be parsed in order to determine that they contain PHP code, just as with cgi-type SSI.
If SSI is not configured on a server, pages are simply transmitted to the client; the server has no need to "read through" them to look for "<?php" or "<!--#", indicating a php or cgi include, respectively. If you enable server parsing, then the server must scan through the entire contents of each page looking for those strings and inserting the appropriate content or executing the appropriate handler to "construct" the page before it can be sent to the client.
So, the only fundamental difference in this regard between cgi and php includes is the handler that gets called when the server detects an included sequence.
Jim
Your URLs need not have any relationship to the names of their content files, as long as you have the correct handlers and MIME-types configured. You can use mod_rewrite to map .html URLs to .php or .shtml files any way you like.
Would you expand on this, and where I might go tolearn enough more to focus my next questions?