cancel
Showing results for 
Search instead for 
Did you mean: 

Expert on Apache wanted

Highlighted
Community Veteran
Posts: 6,983
Thanks: 8
Registered: ‎10-04-2007

Expert on Apache wanted

Where to start  Huh
I run a website for my Model Railway club www.hmrg.co.uk and the site was getting quite large so I decided to make use of SSI so that I could make global changes by including a standard header on every page with the html code <!--#include virtual="header1.inc"--> and included the relevant .htaccess file "AddType text/html .html .htm AddHandler server-parsed .html .htm".
This all works well on the Plusnet server and maked changing the buttons and links on all the pages a doddle.
However there is a snag in that I have to upload the changed "header1.inc" file in order to see that the changes are what I wanted.
To overcome this I have downloaded and installed Apache Version 2.2.4 on my main PC.  so that I could see the changes locally.
Apache works ok but I cannot make it run the <!--#include virtual="header1.inc"--> line when it loads a html file and it just ignores it.
The config file I have for apache can be seen here
I have tried everything I can think of and as far as I can see I have included everthing I need to so that it works with the SSI locally.
I would be very grateful if anyone can shed any light on why it is ignoring the include command  Smiley
8 REPLIES 8
Highlighted
Community Veteran
Posts: 3,789
Thanks: 1
Registered: ‎08-06-2007

Re: Expert on Apache wanted

I'm assuming you're using unix at home - some of these suggestions will require translating into a windows environment Smiley
Firstly, ensure that mod_include is loaded.  You should have the following line (or similar) in your httpd.conf:
LoadModule include_module modules/mod_include.so

If you have PHP enabled on the server, you can check the status of loaded modules by creating a text file called "phpinfo.php" in your web root containing:

<?php
phpinfo();
?>

This will show you a screen with a summary of PHP and Apache modules loaded.    If you're using Apache2, you should have an "apache2handler" section, and loaded modules will show "mod_include" listed.
As long as mod_include is listed, it may then be a permissions problem.  Check the access_log and error_log files to see whether there are any telling signs that it cannot find the correct files, or cannot open them.  (I believe it will complain about an fopen() call failing, but my memory is failing somewhat!)
If that still doesn't help, post back and we'll dig on further!
B.
Highlighted
Community Veteran
Posts: 6,983
Thanks: 8
Registered: ‎10-04-2007

Re: Expert on Apache wanted

Quote from: zubel
I'm assuming you're using unix at home - some of these suggestions will require translating into a windows environment Smiley

Using the  Apache version for windows on Xp and "LoadModule include_module modules/mod_include.so" is in the config file.
the file "mod_include is also listed in the "Modules" folder
No messages of complaint seem to be visable in the error logs.
Highlighted
Community Veteran
Posts: 3,789
Thanks: 1
Registered: ‎08-06-2007

Re: Expert on Apache wanted

did you try the phpinfo() to see if it's being loaded correctly?
Highlighted
Community Veteran
Posts: 3,789
Thanks: 1
Registered: ‎08-06-2007

Re: Expert on Apache wanted

I've just checked your httpd file.  It seems that the Option statement isn't set correctly.
Find the line:
<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs">
just beneath that is an Options directive:
Options Indexes FollowSymLinks
Change this to:
Options Indexes FollowSymLinks +Includes
Save the file, restart httpd and see if that makes a difference.
B.,
Highlighted
Community Veteran
Posts: 6,983
Thanks: 8
Registered: ‎10-04-2007

Re: Expert on Apache wanted

Didn't try the php suggestion as I don't have php on the system yet.
I will have a look at the  setting you suggested but I have to go out for a while now and will let you know later how I get on.
Thanks for the help so far  Wink
Highlighted
Community Veteran
Posts: 3,789
Thanks: 1
Registered: ‎08-06-2007

Re: Expert on Apache wanted

You should also remove the stray "Options Includes" from earlier in the file (just after the "Listen 80" line)
That change you made precedes the "default declaration" in the httpd.conf file.  The default declaration then overrides your Options Includes which is probably why it's not parsing them correctly.
The Apache httpd.conf file is parsed "top down", so any later declarations override earlier ones.
Making the change I pointed out above, (preceding the word Includes with a '+') means it will apply to the DocumentRoot, and all subdirectories.  Without the '+' it will only apply to the specific directory it is granted to.
B.
Highlighted
Community Veteran
Posts: 6,983
Thanks: 8
Registered: ‎10-04-2007

Re: Expert on Apache wanted

zubel you are indeed a genius.
I decided to ditch the config file and start with the default one (which I had saved) and then made the changes  you listed.
[glow=red,2,300]Bingo[/glow]
It works a treat.
Many many thanks for your help  Smiley
Highlighted
Community Veteran
Posts: 3,789
Thanks: 1
Registered: ‎08-06-2007

Re: Expert on Apache wanted

My pleasure Smiley
B.