SSI, CGI executable, files outside htdocs (alias)

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

SSI, CGI executable, files outside htdocs (alias)

Postby Seymour Clufley » 25. March 2008 00:48

I've read of other people having the same problem on this forum. I've tried different solutions but none work.

I'm using CGI executables. They are placed in the cgi-bin folder in Xampp's folder ("C:\Xampp\cgi-bin"). I can use them successfully to generate whole pages, but what I'm trying to do is use them as includes, generating only a part of a page on loading.

Everything works if the webpage files are in the directory:

"C:\xampp\htdocs\xampp\*.shtml".

But for various reasons I'd prefer to store them elsewhere. This doesn't cause any problems except in the case of SSI.

Here is the contents of my conf file:

Code: Select all
ThreadsPerChild 250
MaxRequestsPerChild  0
ServerRoot "C:/xampp/apache"
Listen 80
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 authn_default_module modules/mod_authn_default.so
LoadModule authn_file_module modules/mod_authn_file.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_user_module modules/mod_authz_user.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.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 log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule status_module modules/mod_status.so
LoadModule ssl_module modules/mod_ssl.so

LoadModule autoindex_color_module modules/mod_autoindex_color.so
ServerAdmin admin@localhost
ServerName localhost:80
DocumentRoot "C:/xampp/htdocs"
<Directory />
    Options FollowSymLinks +Includes ExecCGI
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>
<Directory "C:/xampp/htdocs">
    Options Indexes FollowSymLinks +Includes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all

</Directory>
<IfModule dir_module>
    DirectoryIndex index.php index.php4 index.php3 index.cgi index.pl index.html index.htm index.shtml index.phtml
</IfModule>
<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
</FilesMatch>
ErrorLog logs/error.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>
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>
    CustomLog logs/access.log common
</IfModule>

<IfModule alias_module>
    ScriptAlias /cgi-bin/ "C:/xampp/cgi-bin/"
</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-compress .Z
    AddType application/x-gzip .gz .tgz
    AddHandler cgi-script .pl .exe
    AddHandler text/html .shtml
   AddType text/html .shtml
   AddOutputFilter INCLUDES .shtml
</IfModule>
EnableMMAP off
EnableSendfile off
<IfModule alias_module>
<IfModule mime_module>
    LoadModule php5_module "C:/xampp/apache/bin/php5apache2.dll"
    AddType application/x-httpd-php-source .phps
    AddType application/x-httpd-php .php .php5 .php4 .php3 .phtml .phpt

   <Directory "C:/xampp/htdocs/xampp">
      <IfModule php5_module>
         <Files "status.php">
            php_admin_flag safe_mode off
         </Files>
      </IfModule>
   </Directory>

    Alias /security "C:/xampp/security/htdocs/"
    <Directory "C:/xampp/security/htdocs">
      <IfModule php5_module>
         <Files "xamppsecurity.php">
            php_admin_flag safe_mode off
         </Files>
      </IfModule>
        AllowOverride AuthConfig
        Order allow,deny
        Allow from all
    </Directory>

    Alias /phpmyadmin "C:/xampp/phpMyAdmin/"
    <Directory "C:/xampp/phpMyAdmin">
        AllowOverride AuthConfig
        Order allow,deny
        Allow from all
    </Directory>

    Alias /webalizer "C:/xampp/webalizer/"
    <Directory "C:/xampp/webalizer">
      <IfModule php5_module>
         <Files "webalizer.php">
            php_admin_flag safe_mode off
         </Files>
      </IfModule>
        AllowOverride AuthConfig
        Order allow,deny
        Allow from all
    </Directory>

      Alias /contrib "C:/xampp/contrib/"
    <Directory "C:/xampp/contrib">
      <IfModule php5_module>
         <Files "webalizer.php">
            php_admin_flag safe_mode off
         </Files>
      </IfModule>

        AllowOverride AuthConfig
        Order allow,deny
        Allow from all
    </Directory>

Alias /test "P:/test/upload"
<Directory "P:/test/upload" >
Options Indexes
Order allow,deny
Allow from all
</Directory>

</IfModule>
</IfModule>
<IfModule auth_remote_module>
    <Directory "C:/xampp/htdocs/fonts">
    AllowOverride All
    AuthType           Basic
    AuthName           "AUTH REMOTE TEST"
    AuthRemoteServer   localhost
    AuthRemotePort     80
    AuthRemoteURL      /forbidden/
    Require            valid-user
</Directory>
</IfModule>
<IfModule mysql_auth_module>
<Location /restricted>
     AuthMySQLEnable On
    AuthName "MySQL Secured Place"
    AuthType Basic
    require valid-user
    AuthMySQLHost localhost
    AuthMySQLUser root
    AuthMySQLDB webauth
    AuthMySQLUserTable user_pwd
    AuthMySQLNameField name
    AuthMySQLPasswordField pass
    AuthMySQLPwEncryption none
</Location>
</IfModule>


Alias /error/ "C:/xampp/apache/error/"

<Directory "C:/xampp/apache/error">
    AllowOverride None
    Options IncludesNoExec
    AddOutputFilter Includes html
    AddHandler type-map var
    Order allow,deny
    Allow from all
    LanguagePriority en cs de es fr it ja ko nl pl pt-br ro sv tr
    ForceLanguagePriority Prefer Fallback
</Directory>

ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
ErrorDocument 410 /error/HTTP_GONE.html.var
ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var
ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var
ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var
ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var


IndexOptions FancyIndexing VersionSort
Alias /icons/ "C:/xampp/apache/icons/"

<Directory "C:/xampp/apache/icons">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image2.gif) image/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*

AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif core

AddIcon /icons/back.gif ..
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^
DefaultIcon /icons/unknown.gif
ReadmeName README.html
HeaderName HEADER.html
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t


AddLanguage ca .ca
AddLanguage cs .cz .cs
AddLanguage da .dk
AddLanguage de .de
AddLanguage el .el
AddLanguage en .en
AddLanguage eo .eo
AddLanguage es .es
AddLanguage et .et
AddLanguage fr .fr
AddLanguage he .he
AddLanguage hr .hr
AddLanguage it .it
AddLanguage ja .ja
AddLanguage ko .ko
AddLanguage ltz .ltz
AddLanguage nl .nl
AddLanguage nn .nn
AddLanguage no .no
AddLanguage pl .po
AddLanguage pt .pt
AddLanguage pt-BR .pt-br
AddLanguage ru .ru
AddLanguage sv .sv
AddLanguage zh-CN .zh-cn
AddLanguage zh-TW .zh-tw
LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW
ForceLanguagePriority Prefer Fallback
AddCharset us-ascii.ascii .us-ascii
AddCharset ISO-8859-1  .iso8859-1  .latin1
AddCharset ISO-8859-2  .iso8859-2  .latin2 .cen
AddCharset ISO-8859-3  .iso8859-3  .latin3
AddCharset ISO-8859-4  .iso8859-4  .latin4
AddCharset ISO-8859-5  .iso8859-5  .cyr .iso-ru
AddCharset ISO-8859-6  .iso8859-6  .arb .arabic
AddCharset ISO-8859-7  .iso8859-7  .grk .greek
AddCharset ISO-8859-8  .iso8859-8  .heb .hebrew
AddCharset ISO-8859-9  .iso8859-9  .latin5 .trk
AddCharset ISO-8859-10  .iso8859-10  .latin6
AddCharset ISO-8859-13  .iso8859-13
AddCharset ISO-8859-14  .iso8859-14  .latin8
AddCharset ISO-8859-15  .iso8859-15  .latin9
AddCharset ISO-8859-16  .iso8859-16  .latin10
AddCharset ISO-2022-JP .iso2022-jp .jis
AddCharset ISO-2022-KR .iso2022-kr .kis
AddCharset ISO-2022-CN .iso2022-cn .cis
AddCharset Big5.Big5   .big5 .b5
AddCharset cn-Big5 .cn-big5
AddCharset WINDOWS-1251 .cp-1251   .win-1251
AddCharset CP866   .cp866
AddCharset KOI8  .koi8
AddCharset KOI8-E  .koi8-e
AddCharset KOI8-r  .koi8-r .koi8-ru
AddCharset KOI8-U  .koi8-u
AddCharset KOI8-ru .koi8-uk .ua
AddCharset ISO-10646-UCS-2 .ucs2
AddCharset ISO-10646-UCS-4 .ucs4
AddCharset UTF-7   .utf7
AddCharset UTF-8   .utf8
AddCharset UTF-16  .utf16
AddCharset UTF-16BE .utf16be
AddCharset UTF-16LE .utf16le
AddCharset UTF-32  .utf32
AddCharset UTF-32BE .utf32be
AddCharset UTF-32LE .utf32le
AddCharset euc-cn  .euc-cn
AddCharset euc-gb  .euc-gb
AddCharset euc-jp  .euc-jp
AddCharset euc-kr  .euc-kr
AddCharset EUC-TW  .euc-tw
AddCharset gb2312  .gb2312 .gb
AddCharset iso-10646-ucs-2 .ucs-2 .iso-10646-ucs-2
AddCharset iso-10646-ucs-4 .ucs-4 .iso-10646-ucs-4
AddCharset shift_jis   .shift_jis .sjis

<IfModule userdir_module>
    UserDir "My Documents/My Website"
    <Directory C:/Documents and Settings/*/"My Documents/My Website">
        AllowOverride FileInfo AuthConfig Limit Indexes
        Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
        <Limit GET POST OPTIONS>
            Order allow,deny
            Allow from all
        </Limit>
        <LimitExcept GET POST OPTIONS>
            Order deny,allow
            Deny from all
        </LimitExcept>
    </Directory>
</IfModule>



<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from .example.com
</Location>
<Location /server-info>
    SetHandler server-info
    Order deny,allow
    Deny from all
    Allow from .example.com
</Location>







<IfModule dav_module>
<IfModule dav_fs_module>
<IfModule setenvif_module>
<IfModule authn_file_module>

DavLockDB "C:/xampp/tmp/DavLock"
Alias /webdav "C:/xampp/webdav"

<Directory "C:/xampp/webdav">
    Dav On
    Order allow,deny
    Allow from all
    AuthName DAV-upload
    AuthType Basic
    AuthUserFile "C:/xampp/security/htpasswd.webdav"

       <LimitExcept GET HEAD OPTIONS>
        require valid-user
       </LimitExcept>
</Directory>
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "MS FrontPage" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully
BrowserMatch "^gnome-vfs/1.0" redirect-carefully
BrowserMatch "^XML Spy" redirect-carefully
BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully
BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On
</IfModule>
</IfModule>
</IfModule>
</IfModule>


Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
UseCanonicalName Off
AccessFileName .htaccess
ServerTokens Full
ServerSignature On
HostnameLookups Off

Listen 443
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl    .crl
SSLPassPhraseDialog  builtin
SSLSessionCache         dbm:logs/ssl.scache
SSLSessionCacheTimeout  300
SSLMutex  default

<VirtualHost _default_:443>
    DocumentRoot "C:/xampp/htdocs"

    ServerName localhost:443
    ServerAdmin admin@localhost

    ErrorLog logs/error.log
    <IfModule log_config_module>
        CustomLog logs/access.log combined
    </IfModule>
    SSLEngine on
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    SSLCertificateFile conf/ssl.crt/server.crt
    SSLCertificateKeyFile conf/ssl.key/server.key
    <Location />
    </Location>
    <FilesMatch "\.(cgi|shtml|phtml|php|php5|php4|php3)$">
        SSLOptions +StdEnvVars
    </FilesMatch>
    <Directory "C:/xampp/apache/cgi-bin">
        SSLOptions +StdEnvVars
    </Directory>
    <IfModule setenvif_module>
        BrowserMatch ".*MSIE.*" \
                 nokeepalive ssl-unclean-shutdown \
                 downgrade-1.0 force-response-1.0
    </IfModule>
    <IfModule log_config_module>
        CustomLog logs/ssl_request.log \
                  "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
    </IfModule>
</VirtualHost>

<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>


The alias being used is "test", with the shtml files being stored in "P:\test\upload\".

And here's an example of how the shtml files call the include:

Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<TITLE>test</TITLE>
</HEAD><BODY>

before
<!--#exec cgi="../cgi-bin/program.exe"-->
after

</BODY></HTML>


Help would be greatly appreciated.

Thanks for reading,
Seymour.
Seymour Clufley
 
Posts: 11
Joined: 16. March 2008 09:40

Postby Nobbie » 25. March 2008 11:55

<!--#exec cgi="../cgi-bin/program.exe"-->


Try to leave out the two dots in the beginning, as cgi=... expects a valid URL (relative to your domain i.e. localhost) and not a pathname:

Code: Select all
<!--#exec cgi="/cgi-bin/program.exe"-->


If you use '#INCLUDE VIRTUAL' (instead of exec cgi) you may also pass parameters to the executable file (if necessary):

Code: Select all
<!--#include virtual="/cgi-bin/program.exe?par1=blabla?par2=blubb"-->
Nobbie
 
Posts: 8779
Joined: 09. March 2008 13:04

Postby Seymour Clufley » 26. March 2008 01:15

Thanks, Nobbie. I got it working this morning but these tips are very useful.

The lines under Alias /test "P:/test/upload" needed to be changed to this:

Code: Select all
Options Indexes FollowSymLinks +Includes ExecCGI
    <Directory "P:/test/upload" >
    AllowOverride All
    Order allow,deny
    Allow from all
Seymour Clufley
 
Posts: 11
Joined: 16. March 2008 09:40


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 55 guests