SSI messes up my .shtml page!


#1

Hey everyone!

I tried to implement an additional script into a .shtml file! What happened when I added the <!–#include… line is, that I only got a totally blank white page in Internet Explorer (source code shows a blank html page) and in Opera I even got some cryptic signs on the page. When I remove the line, everything’s back to normal again! It’s definitely not the php file I want to include or a wrong path, because if I make a .php page out of the shtml one and use the proper php command to include the file, it works!

I read that SSI’s are enabled by default at Dreamhost, so this can’t be the prob, I guess!? I also tried to turn off the mod_security module, with no result at all!

Anyone got an idea what could be the cause for this problem?

Greets

OneWhoKnows


#2

Since you decided to use an expletive in the title of your post, I am going to make no effort to help you whatsoever.


Simon Jessey | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#3

OK, sorry - edited that. Didn’t really think about that!


#4

Thanks for your reply ardco!

This is the code I used: <!- -#include virtual=“script.php”- ->
(without the spaces between the – of course)

I also tried it with “file” though, with the same result. I include the .php file of the script itself, not another .shtml file. I don’t really think it has something to do with the file permission of the somescript.php file either because, like I said - I tried to include the file in php aswell.

Meaning, I renamed my index.shtml into index.php, and the using this command: <?PHP include("ttt-in.php"); ?> That way it works perfect!

Strange, isn’t it?


#5

[quote]This is the code I used: <!- -#include virtual=“script.php”- ->
(without the spaces between the – of course)

I also tried it with “file” though, with the same result. I include the .php file of the script itself, not another .shtml file. I don’t really think it has something to do with the file permission of the somescript.php file either because, like I said - I tried to include the file in php aswell.

Meaning, I renamed my index.shtml into index.php, and the using this command: <?PHP include("ttt-in.php"); ?> That way it works perfect![/quote]
This is expected behavior. If you try to include a PHP script in an .shtml page, the PHP will not be interpreted. The .php extension is needed for this to work properly (although you may be able to edit an .htaccess file to get it to work).


Simon Jessey | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#6

Including PHP files via SSI should work fine. While I haven’t used SSI in years, I’ve done exactly this many times in the past. I just tried it again on my DH account and it works fine.

My SSI file, ssi.shtml, contains nothing but:

<!--#include virtual="phpinfo.php"--> And phpinfo.php, as you might guess, contains just:

<?php phpinfo(); ?> Loading ssi.shtml in a browser displays the phpinfo() output.


If you want useful replies, ask smart questions.


#7

Are you saying that .shtml files are handled by the PHP interpreter by default? Isn’t that rather unusual? It certainly doesn’t happen with .html files.


Simon Jessey | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#8

No, .shtml files are still handled by mod_include, and you have to use SSI syntax in them. But if you include a PHP file from them, the PHP will be interpreted and the output will be inserted into the SSI file the same way static HTML is.


If you want useful replies, ask smart questions.


#9

Thanks, Dude. I didn’t know it worked that way. Perhaps I’ll add something to the wiki about it.


Simon Jessey | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#10

I’ve described the problem at
http://www.spm-sports.com/problem.html

incase any of the character get mangle.

SSI PHP seems to works fine with as long a browser doesn’t send Accept-Encoding, but if it does, then the HEADER claims the file is encoded, but it doesn’t look like it is.

(spaces intentionally added after < for this message, but are not in files)

= = = file:a.shtml = = =
< !–#include virtual="/b.php" -->

= = = file:b.php = = =
< ?php phpinfo(); ?>

– curl sends without ‘Accept-Encoding’
% curl -i http://www.spm-sports.com/a.shtml
– works as expected, output is html output of phpinfo()

% curl -i -H “Accept-Encoding: gzip” http://www.spm-sports.com/a.shtml
– response claims Content-Encoding of gzip in header
– however, content for the most part seems human readable and uncompressed

% curl -H “Accept-Encoding: gzip” http://www.spm-sports.com/a.shtml | gunzip -
– gunzip doesn’t like encoding
– gunzip: stdin: not in gzip format

– demonstrates command should work and not generate “not in gzip formt” error
% curl -H “Accept-Encoding: gzip” http://diveintomark.org | gunzip -
– HTML output as expected

So am I doing something wrong, or is the HTTP server not quite right?

(see also:http://jclark.org/weblog/2004/01/23/buganat/)