Nested Server Side Includes

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I'm just in the midst of putting a client's website on a professional
hosting service and am encountering an odd problem. I can do Server Side
Includes but not NESTED Server Side Includes. Can anyone here suggest a
way to resolve this problem?

Basically, I want to have two or three levels of SSIs. My HTML pages will
contain both normal HTML statemenet and includes that embed other partial
documents. Those partial documents will, in turn, embed OTHER partial
documents. I've used this technique successfully on other servers but for
some reason, only the highest level includes, those in the HTML
documents, work. The SSIs that are nested within the lower level
documents are simply ignored.

I've checked the documentation on the hosting service and they swear they
allow SSI but don't say anything about NESTED SSI. In the past, I've
never had any problem getting nested SSI to work if SSI was supported in
the first place so I'm not sure what to do here.

I'm guessing that I need an .htaccess file with specific directives in
it. At the moment, this is my .htaccess file:

AddType text/html .shtml
AddHandler server-parsed .shtml

However, I'm not sure if the server is actually using Apache or one of
the alternatives. Can someone tell me a way to figure that out? They have
several forms of tech support but their support is TERRIBLE, at least
today. (They were better earlier in the week when we had a problem with
the account.) So I thought I'd try here in the hopes of resolving my
problem sooner. If I get no joy here, I'll contact them again on Monday
and hope that they are more helpful then.

In the meantime, if you can tell me how to get my nested Server Side
Includes to work, I'd be grateful.

For bonus points, I'd love to know how to tell whether a given site is
using Apache or one of the alternatives ;-)

--
Ten-Blade


Re: Nested Server Side Includes

On 4/14/2012 5:16 PM, Ten Blade wrote:
Quoted text here. Click to load it


Does your server support Perl? Upload this and run it from your browser.


#!/usr/bin/perl

$| = 1;

print "Content-type: text/html\n\n";
print "<html><body>\n";
print "This is a test!\n";

print "<p>Running Perl Version $]</p>";

print "<p>";

foreach $key ( keys %ENV )
{
      print "$key = $ENV<br>\n";
}

print "</body></html>\n";



Re: Nested Server Side Includes

email.me:

Quoted text here. Click to load it

Apparently not. I saved your script as info.perl and uploaded it to the
server but when I go to that page, I get Error 500.

Thanks for the suggestion though....

Quoted text here. Click to load it













--
Ten-Blade


Re: Nested Server Side Includes

On 4/14/2012 7:16 PM, Ten Blade wrote:
Quoted text here. Click to load it


Quite easy.  Get the HTTP Headers plugin for Firefox (something ANY
developer should have) and look at the headers returned by the server.

I haven't had much trouble with SSIs, but then I don't use them very
often.  Most of my sites run PHP and I use PHP includes.  They work all
the time.

Have you had this working on other servers?  Note that you may or may
not be able to use .htaccess for what you want - it all depends on what
the server's configuration allows.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: Nested Server Side Includes


Quoted text here. Click to load it
I've installed the plugin and it seems to be working but I'm not sure
what I'm looking for. Which particular header tells you whether Apache is
being used? I don't see the word "Apache" anywhere in the output from
Live HTTP Headers....

Frankly, I can't recall the term that describes what Apache is an example
of; that would already give me a clue as to which header I want to
inspect. For example, if Apache and its alternatives were "header
managers", I'd look for a header like "server-header-manager" and see if
it said "Apache 1.3" or whatever.

Quoted text here. Click to load it
I've never had trouble with them anywhere else either. Given that the
hosting service open declares that they support them, I had expected this
to work without difficulty. I'm guessing there's _something_ I need to do
on my side, probably with .htaccess (or its equivalent if Apache is not
being used) that I need to do.

Quoted text here. Click to load it
I've had SSIs working fine on other servers with little if any trouble. I
don't expect I have to do anything too complicated to get this to work.


--
Ten-Blade


Re: Nested Server Side Includes

On Sun, 15 Apr 2012 15:16:35 +0000 (UTC), Ten Blade put finger to keyboard
and typed:

Quoted text here. Click to load it

Oddly enough, it's the 'Server:' header :-)

Here's an example from one of my sites:

Server: Apache/2.2.20 (Ubuntu)

Another way of doing it is to use PHP. Upload a file called 'info.php' that
contains just one line:

<? phpinfo(); ?>

and then view it in your browser. Assuming PHP is installed on the sever
(and it would be an extremely unusualy shared hosting service which doesn't
support PHP) then you'll get a full listing of everything the server
supports as well as information on what type of software it's running.

Mark
--
Blog: http://mark.goodge.co.uk
Stuff: http://www.good-stuff.co.uk

Re: Nested Server Side Includes


Quoted text here. Click to load it

Thank you! Seriously, I didn't know which header I needed and didn't know
where to look....
Quoted text here. Click to load it


Well, now I'm REALLY confused! According to info.php, SERVER_SOFTWARE is
"Apache" (no version number).

I must be using this "Live HTTP" plug-in incorrectly. Live HTTP is
definitely NOT very friendly. It doesn't show a URL in most of its entries
and doesn't show a timestamp so it's very hard to verify which page view
the entry refers to.... I see at least one entry with Microsoft-IIS/7.5 on
it but I have no idea what website that corresponds to. Perhaps that is an
entry for one of the other webpages I have open?

It's a shame that there is no Help documentation for Live HTTP. I can't
find anything at the website that tells you in any detail how to use it.
The author just seems to assume that it is self-explanatory.

Can anyone suggest another free tool that will let me go to a given server
and determine what type of server it is? I'm not going to be happy until I
get consistent results from info.php and some other tool.....

Determing the actual server being used would appear to be essential for
determining the best technique for getting my nested SSIs to work.


--
Ten-Blade


Re: Nested Server Side Includes

On 4/15/2012 5:38 PM, Ten Blade wrote:
Quoted text here. Click to load it

Live HTTP Headers is quite user friendly.  There is a GET or POST
request, including the URL, which is what's being sent to the server.
Immediately following that is the response from the server, which
includes the Server: header, amongst other things.

Remember that almost every page requires multiple requests to the server
- one for the page itself and one for each additional item which must be
downloaded, i.e. images, CSS files, etc.

It does take some knowledge of how HTTP works - but any web developer
should have such a basic understanding, anyway.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: Nested Server Side Includes


Quoted text here. Click to load it

Well, it's NOT friendly to me! I have written Java servlets and have some
basic familiarity with headers, although I am rusty at both servlets and
headers. I've been looking at the information in Live HTTP Headers off
and on all day and I can figure out for the life of me how to associate
what it contains with what my web page is doing.

As I said, many of the entries lack timestamps and URLs so how am I
supposed to match a given entry to a given web page?

All I'm trying to do is see the Server value for one page but there are a
lot of entries here. I don't know if these entries are in chronological
order from oldest to newest or newest to oldest or if they are in
alphabetical order by URL or something else altogether.

Can you enlighten me? Or suggest a tool that is a little more intuitive?


--
Ten-Blade


Re: Nested Server Side Includes

On 4/15/2012 8:12 PM, Ten Blade wrote:
Quoted text here. Click to load it

Timestamps don't matter!  They are in the order of the request followed
by the response.  Then the next request, and the next response.  And so
on.  IOW, they are in the order that things are requested from the
server, each one followed by the response to that request.  The request
has the URL and any data sent in it;  the response has the response code
and other associated information.

What could be simpler than that?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: Nested Server Side Includes


Quoted text here. Click to load it

That's already a heck of a lot more information than I've been able to
find anywhere else - information which should have been readily findable
but was left to the imagination of the user. The problem is, I have a
very good imagination and I could imagine several ways it _might_ work
but I was darned if I could prove any of the possibilities.

Quoted text here. Click to load it
Yeah, it's dead easy if you already know how it works. It's not so damned
easy if you don't.

Even with what you've told me, I'm still not seeing a single Apache
anywhere in this long list of entries. Of course, it would be easy to
miss it since I don't see anything resembling a search/find so that I can
look for all instances of "server" or "Apache".

Okay, I used the Save All function and opened the resulting file in
Notepad. The vast majority of the "server" entries say "Microsoft-IIS/7.5
but a small handful say Apache without any version number. But most of
the ones that identify the server which concerns me are saying Apache so
I think I'm finally satisfied that info.php and the plugin are agreeing
with one another. Previously, when just eyeballing the many entries, I
had seen no Apaches at all but now that I am actually see "Apache" with
URLs that must be getting served from the hosting service, I'm starting
to feel like this is making a bit of sense.

The last thing I wanted to do is waste a lot of time trying to figure out
how to make SSIs work in Apache if the server wasn't using Apache.
Instead, I wasted a lot of time trying to figure out what the plug-in was
saying.

What a frustrating day! I spent several hours playing with SSIs and
couldn't get them to work even though I think I am imitating exactly what
I did successfully elsewhere. I'm still not sure what to try next to
resolve my SSI problem. But it's late so I'm going to try the hosting
company's tech support tomorrow and hope that they are a heck of a lot
more helpful on weekdays than they were on Saturday.

--
Ten-Blade


Re: Nested Server Side Includes

On Mon, 16 Apr 2012 03:55:36 +0000 (UTC), Ten Blade put finger to keyboard
and typed:

Quoted text here. Click to load it

Youi have to remember that any HTML page usually contains multiple files
which may well be served from multiple locations. So it's not at all
uncommon for you to see multiple server types in the responses as well. The
one that matters is the first one, the one that's in the set of responses
to the initial page load request. If that's IIS then that would explain why
SSIs don't work the way they do on Apache.

Someone will probably be along shortly to explain why hosting on IIS is a
bad thing; that's a matter of perspective and it's not necessarily always
the case. But one thing that definitely *is* the case is that
server-specific features, such as SSIs, can't be guaranteed to work
cross-platform. That's one of the reaons why, if portability matters, it's
far better to use a deliberatelr cross-platform scripting system such as
PHP (which, apart from a few more esoteric functions, which run equally
well on any server).

Mark
--
Blog: http://mark.goodge.co.uk
Stuff: http://www.good-stuff.co.uk

Re: Nested Server Side Includes

On 4/16/2012 2:24 AM, Mark Goodge wrote:
Quoted text here. Click to load it
<snip>\


then that would explain why
Quoted text here. Click to load it

That is fairly put.

PHP runs well on IIS although it is annoying to not have .htaccess.
Properly set up php on IIS is relatively trouble free although it has
been my experience that there are more people on the IIS side than the
*nix side who should not be managing and setting up servers! YMMV.

Jeff
Quoted text here. Click to load it


Re: Nested Server Side Includes

On 4/15/2012 11:55 PM, Ten Blade wrote:
Quoted text here. Click to load it

As I said - it requires you to have a basic knowledge of how HTTP works,
which every web developer should have.  Writing a couple of servlets
does not mean you know anything about how HTTP works.

Quoted text here. Click to load it

See above.


Are the requests being made to two different servers?

Quoted text here. Click to load it


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: Nested Server Side Includes

On 4/15/2012 1:00 PM, Mark Goodge wrote:
Quoted text here. Click to load it
<snip>
Quoted text here. Click to load it

FYI. Some hosts turn "off" phpinfo, GoDaddy being one who does. It's not
the only odd thing they do...

   Jeff

Quoted text here. Click to load it


Re: Nested Server Side Includes

On 4/20/2012 4:49 AM, j wrote:
Quoted text here. Click to load it

You can still do phpinfo() on GoDaddy.  I just did it for one of my
clients a couple of weeks ago to see if a particular extension was
installed.

Quoted text here. Click to load it



--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: Nested Server Side Includes

On 4/20/2012 7:19 AM, Jerry Stuckle wrote:
Quoted text here. Click to load it

Perhaps it is something they restrict on their virtual servers. At least
on the one I was working on. I thought it was odd and made a mental
note. I got a response explaining that is was off for security reasons.

I have other complaints about GoDaddy virtual servers, not the least of
which is that the DOCUMENT_ROOT is the set not for the domain's document
root but for the virtual hosting root.

   Jeff
Quoted text here. Click to load it


Re: Nested Server Side Includes

On 4/20/2012 9:57 AM, j wrote:
Quoted text here. Click to load it

Virtual servers should be under your own control, and allow you to load
what you want.  It's not the same as shared hosting.

Quoted text here. Click to load it

Those aren't virtual servers. They are shared hosting.  A huge
difference.  On virtual servers, you control almost everything.

Quoted text here. Click to load it



--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Site Timeline