Server Side Include not working in XAMPP 1.7.2!

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Server Side Include not working in XAMPP 1.7.2!

Postby luisurbina_ve » 09. September 2009 00:00

Hello
I know some people have asked this before, I followed your directions but I still can not get work. I am developing an application, but I am doing the preliminary design in HTML, then start working on JSP.
In HTML not get me put a header common to all pages, I do that with SSI include and the file extension is shtml, still not shown me.

The only change made for me in a APACHE config file is a Options +Include line, but doing that I could not make it work
Please someone help me to solve this problem in Apache and Tomcat.

Thanks for your help.

Here is my HTML code

SampleFile.html file...
Code: Select all
<body><table width="100%" border="0" cellspacing="0" cellpadding="00">
  <tr><td width="15%">&nbsp;</td>
    <td width="70%">
   <!--#include file="../includes/common_header_1.shtml" -->
    </td>
    ...


My Structure
Root_Folder
Folder_One
SampleFile.html
Include <-- this a folder for all my include's files.
common_header_1.shtml
Index.html


well, I've a two servers in my XAMPP installation Apache and Tomcat, In both server's does not display the included file, I checked the Apache configuration file and do not give the error, the same happens with Tomcat, does not display the included file.

here the APACHE configuration File.

Code: Select all
#
# This is the main Apache HTTP server configuration file.  It contains the
#
# ServerRoot: The top of the directory tree under which the server's
ServerRoot "C:/xampp/apache"

#
#Listen 0.0.0.0:80
#Listen [::]:80
Listen 80

#
# Dynamic Shared Object (DSO) Support
#
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
#LoadModule authn_alias_module modules/mod_authn_alias.so
#LoadModule authn_anon_module modules/mod_authn_anon.so
#LoadModule authn_dbd_module modules/mod_authn_dbd.so
#LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authn_file_module modules/mod_authn_file.so
#LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
#LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
#LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_user_module modules/mod_authz_user.so
##LoadModule autoindex_module modules/mod_autoindex.so # replaced with autoindex_color_module
#LoadModule bucketeer_module modules/mod_bucketeer.so
#LoadModule cache_module modules/mod_cache.so
#LoadModule case_filter_module modules/mod_case_filter.so
#LoadModule case_filter_in_module modules/mod_case_filter_in.so
#LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule cgi_module modules/mod_cgi.so
#LoadModule charset_lite_module modules/mod_charset_lite.so
LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule dav_lock_module modules/mod_dav_lock.so
#LoadModule dbd_module modules/mod_dbd.so
#LoadModule deflate_module modules/mod_deflate.so
LoadModule dir_module modules/mod_dir.so
#LoadModule disk_cache_module modules/mod_disk_cache.so
#LoadModule dumpio_module modules/mod_dumpio.so
#LoadModule echo_module modules/mod_echo.so
LoadModule env_module modules/mod_env.so
#LoadModule example_module modules/mod_example.so
#LoadModule expires_module modules/mod_expires.so
#LoadModule ext_filter_module modules/mod_ext_filter.so
#LoadModule file_cache_module modules/mod_file_cache.so
#LoadModule filter_module modules/mod_filter.so
LoadModule headers_module modules/mod_headers.so
#LoadModule ident_module modules/mod_ident.so
#LoadModule imagemap_module modules/mod_imagemap.so
LoadModule include_module modules/mod_include.so
LoadModule info_module modules/mod_info.so
LoadModule isapi_module modules/mod_isapi.so
#LoadModule ldap_module modules/mod_ldap.so
#LoadModule logio_module modules/mod_logio.so
LoadModule log_config_module modules/mod_log_config.so
#LoadModule log_forensic_module modules/mod_log_forensic.so
#LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule mime_module modules/mod_mime.so
#LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule negotiation_module modules/mod_negotiation.so
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
#LoadModule speling_module modules/mod_speling.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule status_module modules/mod_status.so
#LoadModule substitute_module modules/mod_substitute.so
#LoadModule unique_id_module modules/mod_unique_id.so
#LoadModule userdir_module modules/mod_userdir.so
#LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule version_module modules/mod_version.so
#LoadModule vhost_alias_module modules/mod_vhost_alias.so

#
# 3rd party modules
#
LoadModule autoindex_color_module modules/mod_autoindex_color.so

<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
User daemon
Group daemon

</IfModule>
</IfModule>

# 'Main' server configuration
#
ServerAdmin postmaster@localhost

#
ServerName localhost:80

#
DocumentRoot "C:/xampp/htdocs"

#
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

#
<Directory "C:/xampp/htdocs">
    Options Indexes FollowSymLinks Includes ExecCGI

    AllowOverride All

    #
    # I INCLUDE THIS CHANGES
    #
    [color=#4000FF]Options +Includes[/color]

    Order allow,deny
    Allow from all

</Directory>

#
<IfModule dir_module>
    DirectoryIndex index.php index.pl index.cgi index.asp index.shtml index.html index.htm \
                   default.php default.pl default.cgi default.asp default.shtml default.html default.htm \
                   home.php home.pl home.cgi home.asp home.shtml home.html home.htm
</IfModule>

#
<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</FilesMatch>

#
ErrorLog "logs/error.log"

#ScriptLog "logs/cgi.log"

#
LogLevel warn

<IfModule log_config_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      # You need to enable mod_logio.c to use %I and %O
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    #
    #CustomLog "logs/access.log" common

    #
    CustomLog "logs/access.log" combined
</IfModule>

<IfModule alias_module>
    #
    ScriptAlias /cgi-bin/ "C:/xampp/cgi-bin/"

</IfModule>

<IfModule cgid_module>
    #
    # ScriptSock: On threaded servers, designate the path to the UNIX
    # socket used to communicate with the CGI daemon of mod_cgid.
    #
    #Scriptsock "logs/cgi.sock"
</IfModule>

#
<Directory "C:/xampp/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

#
DefaultType text/plain

<IfModule mime_module>
    #
    TypesConfig "conf/mime.types"

    #
    #AddType application/x-gzip .tgz
    #
    #AddEncoding x-compress .Z
    #AddEncoding x-gzip .gz .tgz
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    #
    AddHandler cgi-script .cgi .pl .asp

    # For type maps (negotiated resources):
    #AddHandler type-map var

    #
    # Filters allow you to process content before it is sent to the client.
    #
    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add "Includes" to the "Options" directive.)
    #
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
</IfModule>

<IfModule mime_magic_module>
    #
    MIMEMagicFile "conf/magic"
</IfModule>

# XAMPP specific settings
Include "conf/extra/httpd-xampp.conf"

# Perl settings
Include "conf/extra/perl.conf"

# Server-pool management (MPM specific)
Include "conf/extra/httpd-mpm.conf"

# Multi-language error messages
Include "conf/extra/httpd-multilang-errordoc.conf"

# Fancy directory listings
Include "conf/extra/httpd-autoindex.conf"

# Language settings
Include "conf/extra/httpd-languages.conf"

# User home directories
Include "conf/extra/httpd-userdir.conf"

# Real-time info on requests and configuration
Include "conf/extra/httpd-info.conf"

# Virtual hosts
Include "conf/extra/httpd-vhosts.conf"

# Distributed authoring and versioning (WebDAV)
Include "conf/extra/httpd-dav.conf"

# Implements a proxy/gateway for Apache.
Include "conf/extra/httpd-proxy.conf"

# Various default settings
Include "conf/extra/httpd-default.conf"

# Secure (SSL/TLS) connections
Include "conf/extra/httpd-ssl.conf"
#
# Note: The following must must be present to support
#       starting without SSL on platforms with no /dev/random equivalent
#       but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
    SSLRandomSeed startup builtin
    SSLRandomSeed connect builtin
    SSLSessionCache "shmcb:logs/ssl.scache(512000)"
    SSLSessionCacheTimeout 300
</IfModule>

# Tomcat settings
Include "conf/extra/mod_jk.conf"
luisurbina_ve
 
Posts: 12
Joined: 08. September 2009 03:06

Re: Server Side Include not working in XAMPP 1.7.2!

Postby Izzy » 09. September 2009 01:14

Server Side Includes (SSI) works and is enabled "out of the box" in XAMPP, I have just tested your SSI and it works if you follow a few simple instructions re how SSI works.

So put your httpd.conf file back to the default settings first as this is important, to eliminate any errors that might have been introduced when editing the file.

Next the html file that contains the #include statements must have the .shtml file extension for Apache to parse the include instructions - so rename sample.html to sample.shtml

The included file can be named common_header_1.html or, as in the sample included in XAMPP, it can be named common_header_1.inc or if it contains PHP then it could be named common_header_1.php and if it contains another #include statement then the file could be named common_header_1.shtml and so on etc.etc.
Note that if you name your included file common_header_1.shtml but it does not contain an #include statement then Apache will still parse the file and serve the rest of the content to the browser anyway.
On the other hand if you name it common_header_1.html and it contains an #include statement then Apache will not parse the file looking for the #include statement and so the #include statement will fail but the rest of the content may be served to the browser
.

You will see this sample called ssi.shtml and ssi.inc in the C:\xampp\htdocs\xampp folder.
http://localhost/xampp/ssi.shtml
Should return OK in your browser.

Some reading:
http://httpd.apache.org/docs/2.2/howto/ssi.html
http://httpd.apache.org/docs/2.2/mod/mod_include.html
http://httpd.apache.org/docs/2.2/mod/core.html#options

BTW the Options +Includes that is referred to in many docs is already in the DocumentRoot "C:/xampp/htdocs" under the <Directory "C:/xampp/htdocs"> directive but the + has been dropped and so becomes simply Options Includes in this line in the httpd.conf file:
httpd.conf wrote:# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks Includes ExecCGI

#


Post back with how you get on after making the above changes so it might help others reading this topic when doing an advanced forum search.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: Server Side Include not working in XAMPP 1.7.2!

Postby luisurbina_ve » 09. September 2009 03:46

Thanks Izzy for your faster response...

I followed the directions that you sugest:

    -. Restore the original settings of httpd.conf file for my Apache Server.
    -. Rename a file sample.html to sample.shtml
    -. Call a sample.shtml with the #Include options with each one of followed file:
      a) <!--#include file="../includes/common_header_1.inc" -->
      b) <!--#include file="../includes/common_header_1.html" -->
      c) <!--#include file="../includes/common_header_1.shtml" -->

Making these changes and test each one of sample.shtml, the result I got the following error.

[an error occurred while processing this directive]

This is just the place you should submit the included file. I thought it might be a safety problem and privileges already granted full control to IUSR user, meaning that this is not.

Do you have any idea of what happening?
greetings
luisurbina_ve
 
Posts: 12
Joined: 08. September 2009 03:06

Re: Server Side Include not working in XAMPP 1.7.2!

Postby Wiedmann » 09. September 2009 03:56

Code: Select all
<!--#include file="../includes/common_header_1.inc" --

According to your file/directory structure above, the path is wrong.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Server Side Include not working in XAMPP 1.7.2!

Postby luisurbina_ve » 09. September 2009 04:22

Thanks for your early response Wiedmann

I'm using a Dreamweaver for design my pages and I be sure that the path is correct.

The Directory Structure is:
    Root
      html_files
        sample.shtml
      Includes
        common_header_1.html
        common_header_1.shtml
        common_header_1.inc

for this reason I used this path in a sample.shtml located in html_files to a common_header_1.inc in a Includes folder.
<!--#include file="../includes/common_header_1.inc" -->

Thanks but it's not the problem.

Luis
luisurbina_ve
 
Posts: 12
Joined: 08. September 2009 03:06

Re: Server Side Include not working in XAMPP 1.7.2!

Postby Wiedmann » 09. September 2009 04:30

    Root
      html_files
        sample.shtml

So you are accessing the this file with the URI http://localhost/html_files/sample.shtml?

    Root
      Includes
        common_header_1.html

And it's also possible to access this file with http://localhost/Includes/common_header_1.html?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Server Side Include not working in XAMPP 1.7.2!

Postby luisurbina_ve » 09. September 2009 15:22

Hi Wiedmann

Yes, I can enter without any problem in Firefox, IE and GC, my files in
the URI http://localhost/html_files/sample.shtml and
http://localhost/Includes/common_header_1.html or
http://localhost/Includes/common_header_1.shtml or
http://localhost/Includes/common_header_1.inc

But as I said, when entering the sample.shtml file, I get an error where the included file should appear.

[an error occurred while processing this directive]

Thanks
Luis
luisurbina_ve
 
Posts: 12
Joined: 08. September 2009 03:06

Re: Server Side Include not working in XAMPP 1.7.2!

Postby Wiedmann » 09. September 2009 15:58

Code: Select all
<!--#include file="../includes/common_header_1.shtml" -->

I get an error where the included file should appear.

OK. Ever read the Documentation?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Server Side Include not working in XAMPP 1.7.2!

Postby luisurbina_ve » 09. September 2009 16:19

Hi Guys

I'm still chewing on wood!, follow the secuence suggested by Izzy
You will see this sample called ssi.shtml and ssi.inc in the C:\xampp\htdocs\xampp folder.
http://localhost/xampp/ssi.shtml
Should return OK in your browser.

And looking that works!!!

Thinking about this, let me see inside this file that works!!!!

I made a following test in a sample_file.shtml:
-. Insert a few lines to call a Include file as show:
<!--#include file="../includes/common_header_1.inc" --> <--- Not work give Error in the includes folder :x
<!--#include file="../common_header_1.inc" --> <--- Not work give Error in the my_test_site folder :x
<!--#include file="common_header_1.inc" --> <--- Works! note that is in same folder, HTML folder :D

<!--#include virtual="/my_test_site/includes/common_header_1.inc" --> <--- Works! in the includes folder :D
<!--#include virtual="/my_test_site/common_header_1.inc" --> <--- Works! in my_test_site folder :D
<!--#include virtual="/my_test_site/html/common_header_1.inc" --> <--- Works! in the same folder :D

my C:\xampp\htdocs it's my root directory for all sites and I need make a virtual domain for each site mine. :?:

looking this, may be the problem that each site is a folder in C:/xampp/htdosc and should be each site folder an Virtual Domain?,
to be accessed like Virtual domain http://my_site_1.local or http://my_site_2.local this makes sense?

How I can change the Apache configuration file to make "n" Virtual Domains by example http://my_test_site and not http://localhost/my_test_site/...

You can give me any Idea?

Thanks
luisurbina_ve
 
Posts: 12
Joined: 08. September 2009 03:06

Re: Server Side Include not working in XAMPP 1.7.2!

Postby luisurbina_ve » 09. September 2009 16:29

Hi Wiedmann

What you say is correct, there is the error!, I read the Documentation
file
The value is a path relative to the directory containing the current document being parsed. It cannot contain ../, nor can it be an absolute path. Therefore, you cannot include files that are outside of the document root, or above the current document in the directory structure. The virtual attribute should always be used in preference to this one.


my C:\xampp\htdocs it's my root directory for all sites and I need make a virtual domain for each site mine.

How I can change the Apache configuration file to make "n" Virtual Domains by example http://my_test_site and not http://localhost/my_test_site/...

Thanks!!!
luisurbina_ve
 
Posts: 12
Joined: 08. September 2009 03:06

Re: Server Side Include not working in XAMPP 1.7.2!

Postby Nobbie » 09. September 2009 16:49

luisurbina_ve wrote:How I can change the Apache configuration file


With a text editor.

And read the docu about "VirtualHost": http://httpd.apache.org/docs/2.2/en/vhosts/
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04

Re: Server Side Include not working in XAMPP 1.7.2!

Postby Izzy » 10. September 2009 00:00

You could also try an Advanced forum search in the XAMPP for Windows forum for virtualhost or vhost as there are many posts with some very useful examples that relate to an XAMPP for Windows installation.

Good to see that you eventually had your SSI up and running, defining the correct paths can sometimes be a real headache.

Good luck and post back in a new topic after you have had a go at the VirtualHost configuration in the C:\xampp\apache\conf\extra\httpd-vhosts.conf file if you get to a log jam situation.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 110 guests