Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to get SSI to work on Debian running Apache, however the .shtml files are not being parsed. From a PHP file with phpinfo() I can see that the following show up in the loaded modules section:

mod_mime_xattr mod_mime mod_mime_magic

In /etc/apache2/mods-enabled/mime.conf I have (among other things):

AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

In /etc/apache2/sites-enabled/domain.com.conf (for the virtual host in question) I have:

<Directory /home/username/public_html>
Options +Includes
allow from all
AllowOverride All 
</Directory>

and for good measure, I added the following as well:

<Directory />
Options +Includes
</directory>

In the user's .htaccess file, I tried adding:

Options +Includes
AddType text/html shtml
AddHandler server-parsed shtml

Nothing seems to work. How can I even debug this?

Edit:

Here is the output of ls /etc/apache2/mods-enabled/ in case this helps

actions.conf          dav_svn.load         proxy_balancer.load
actions.load          deflate.conf         proxy.conf
alias.conf            deflate.load         proxy_connect.load
alias.load            dir.conf             proxy_http.load
auth_basic.load       dir.load             proxy.load
auth_digest.load      env.load             python.load
authn_file.load       fcgid.conf           reqtimeout.conf
authz_default.load    fcgid.load           reqtimeout.load
authz_groupfile.load  mime.conf            rewrite.load
authz_host.load       mime.load            ruby.load
authz_user.load       mime_magic.conf      setenvif.conf
autoindex.conf        mime_magic.load      setenvif.load
autoindex.load        mime-xattr.load      ssl.conf
cgi.load              negotiation.conf     ssl.load
dav_fs.conf           negotiation.load     status.conf
dav_fs.load           php5.conf            status.load
dav.load              php5.load            suexec.load
dav_svn.conf          proxy_balancer.conf
share|improve this question
    
When you visit a .shtml page do you see anything in the Apache error log? –  Zoredache Jul 11 '12 at 0:24
    
Actually, yes. In error.log [error] an unknown filter was not added: includes –  Mike Jul 11 '12 at 0:27
    
Commenting out the line AddOutputFilter INCLUDES .shtml gets rid of the error, but still doesn't solve the problem –  Mike Jul 11 '12 at 0:33
    
OK I figured it out. I'll post my answer in case others are having the same problems. –  Mike Jul 11 '12 at 0:47

1 Answer 1

up vote 4 down vote accepted

In order to get server side includes to work, the include module also needs to be loaded. You can do this by executing the following as root:

a2enmod include

Or execute the following:

ln -s /etc/apache2/mods-enabled/include.conf /etc/apache2/mods-available/include.conf
ln -s /etc/apache2/mods-enabled/include.load /etc/apache2/mods-available/include.load

Then restart apache.

Note, if you were adding SSI to .shtml files from .htaccess you would do AddOutputFilter INCLUDES .shtml. Or substitute .shtml for whatever file type you want to be parsed by the server side includes.

The current Debian config file /etc/apache2/mods-available/mime.conf contains an error in that it adds the following:

<IfModule mod_mime.c>
[...]
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
[...]
</IFModule>

without first checking whether mod_include.c has been loaded. To get around this, you can change those lines to:

<IfModule mod_mime.c>
[...]
<IfModule mod_include.c>
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
</IFModule>
[...]
</IFModule>

The <IFModule> tags can be nested. This will get rid of the error messages that you are experiencing in the event that mod_include.c is not loaded.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.