 |
 |
How to turn on the Server-Side Include (SSI)?
|
 |
|
 |
|
Addicted to MacNN
Join Date: Aug 2001
Location: North Hollywood, CA
Status:
Offline
|
|
One of my friend own a MacOS X Server and all other necessary software such as Apache, WebObject, etc but he is not sure how to turn SSI on. I've found a way to turn it on but it have to be in unrestricted mode for SSI to work properly in all pages. He rather it to be in restricted mode all the time.
For an example of SSI code we use in website:
<!----- include virtual file="anytextfile.txt" ------>
Can anyone help out with an instructions? Thanks 
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Oct 1999
Location: San Jose, Ca
Status:
Offline
|
|
|
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Aug 2001
Location: North Hollywood, CA
Status:
Offline
|
|
Originally posted by larkost:
<STRONG>RTFM:
Apache.org FAQ
Number 7 answers this question.</STRONG>
Well, it is something that we already did. I did read their manual before posting it here so take it easy with your language.
For some reason, SSI isn't being enabled. I'm so sure that I turned it on and added .shtml support. But we still get error code like this:
<!-- include Error: Exec and Include commands are disabled. -->
What am I missing?
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Mar 2001
Status:
Offline
|
|
are you maybe forgetting the pound sign?
<!--#include virtual="/includefile.inc"-->
also, are you trying to include virtual or file? make sure you know the difference between the two because that might be one reason its not working right.
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Aug 2001
Location: North Hollywood, CA
Status:
Offline
|
|
Originally posted by Raman:
<STRONG>are you maybe forgetting the pound sign?
<!--#include virtual="/includefile.inc"-->
also, are you trying to include virtual or file? make sure you know the difference between the two because that might be one reason its not working right.</STRONG>
Yeah, yeah I'm using the pound sign. I'm curious what is the difference between virtual and file? I know that I'm using file for all SSI I use.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Mar 2001
Status:
Offline
|
|
"I'm curious what is the difference between virtual and file?"
The difference is when you want to use site root vs. document root.
Lets say all your include code snippets are in a folder called "rootfolder/lib/inc" . No matter where you wanted to use whatever.inc, you'd type in your HTML.
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
<!--#include virtual=<font color = red>"/lib/inc/whatever.inc"</font>-->
</font>[/code]
That was an example of virtual. The following shows you what a pain in the a$$ document root is. Lets say you had a HTML file 3 directories in from your root "rootfolder/html/mom/mymom.html"
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
<!--#include file=<font color = red>"../../../lib/inc/whatever.inc"</font>-->
</font>[/code]
I bet you don't like the 2nd example, do you? It would get even hairier if you were using template files that included other include files and images in them, because "../../../" might not even be a valid directory depending on where the include file was being "run" from.
Most small sites don't lend themselves to site root (virtual) so you won't see the benefits unless you're using templates, includes, javascripts, and other code.
I work on a huge site and in the new release we went from document root to site root because I saw that the designers kept copying images over and over into directories becuase it was too hard to figure out where ".../../../../../.../.././ [you get my point]" was when that template included an image from "images/banners/shell1.gif" but that template was 1 down from the root. Heh heh.. Anyway, after we rebuilt (and redesigned it) The site went down from 4 gigs to 800 megs. That's great when you consider replication from the development server to staging took almost 2 hours. Now it takes about 1/5th that time!
If you have dreamweaver then look up in the help section about document root, and site root (file, and virtual when you talk about includes).
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Oct 1999
Location: San Jose, Ca
Status:
Offline
|
|
Two things to check: One is that you are trying this in the main document root, not in something that has different settings, be they from the users folder (anything in a ~ area has its own settings in apple's generic setup), a specific overridden area, or a virtual server. If you are in one of these areas you have to turn it on in that area specifically. Also check .htaccess files in path/
Second is that you have restarted the server since making the change.
|
|
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status:
Offline
|
|
Check the following:
1) Locate the <directory> directive that applies to your directory in your httpd.conf file and make sure the line with OPTIONS has 'IncludesNoExec' or '+Includes' (without the quotes, obviously) in those options
2) Make sure the included file has the correct permissions
Is that helpful? 
|
|
Computer thez nohhh...
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Aug 2001
Location: North Hollywood, CA
Status:
Offline
|
|
Thanks y'all for helping me. It's really helpful and I learned a lot from this.
I'm going to experiment a little more on 'virtual' and 'file'. I think 'virtual' is the best way to do since it is time-saving instead of changing each links. But I wonder why do they leave 'file' there if 'virtual' is more easier? Is 'file' in any way superior to 'virtual'?
-Adam Betts
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Mar 2001
Status:
Offline
|
|
Originally posted by Adam Betts:
<STRONG>Thanks y'all for helping me. It's really helpful and I learned a lot from this.
I'm going to experiment a little more on 'virtual' and 'file'. I think 'virtual' is the best way to do since it is time-saving instead of changing each links. But I wonder why do they leave 'file' there if 'virtual' is more easier? Is 'file' in any way superior to 'virtual'?
-Adam Betts</STRONG>
There are times when you might want to use one over the other. Also, if you have a webserver (like IIS on NT workstation or 2000), you don't have to luxury of having multiple sites - you can, however create many virtual sites, but then if someone looked at your code and saw <!--#include virtual="/mywebroot/yoursite/yourincludefile.inc"--> they might be so inclined to poke around in "mywebroot" and see what trouble they could stir.
Have fun.
|
|
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: May 2001
Location: Madison, WI USA
Status:
Offline
|
|
In IIS you actually can have as many individual, non-virtual sites as you like provided you have that many IP addresses. If you have ten IP addresses, you can have 10 sites, each having their own IP, without having to resort to creating virtual sites. If you have only one IP address, though, you're correct, you'll have to set up virtual sites. But either way, "file" or "virtual" includes will work the same.
But as mentioned, don't use .INC as your include-file extension if you can get away with it. Most web application servers won't know how to parse a file with that extension by default, so the end result would be the file being displayed in its entirety in the user's web browser as plain text. So if the user found out that there was a .INC file in use, and it contained sensitive information, like how to connect to your databases, then it would be in plain site for the world to see. Use the file extension for the application server you are using, such as ASP, PHP, JSP, etc.
Best regards,
Chris
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Mar 2001
Status:
Offline
|
|
Not always true, Chris. If you're runing NT or Win2k Server then you can have many websites, each bound to an ip address or use host headers. Regular IIS4 or IIS5 on workstation installs only are allowed to have 1 site. All others are virtual sites under the root.
I'd make sure your include files are of the type of scripting page. Also, try to load up the include file and see if it spews out any code that you thought would be hidden just to make sure.
|
|
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: May 2001
Location: Madison, WI USA
Status:
Offline
|
|
Yes, you're right there. I was presuming you were speaking strictly about Server, not Workstation as well. Workstation versions of IIS only allow a single physical site as you mentioned.
Best regards,
Chris
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|