0
votes

I use Apache to serve web pages using both cgi and ssi (server side include). I even use them both in some cases, that is, the output of the cgi program is further expanded using ssi to generate the final html delivered to the client.

The system works fine on my commercial web host and did work on the Apache installed on my personal computer. But I recently upgraded to Ubuntu 14.04 Trusty Tahr (64 bit) with Debian Apache 2.4.7. Both cgi and ssi work, but only individually. The attempt to expand cgi output further with ssi fails, and the raw output of the cgi program gets delivered to the client.

Suggestions for tweaking the system to work will be appreciated. Another helpful answer would be a short working example, under a hundred lines, of a document that expands cgi output with ssi on the Ubuntu configuration above.

2
Can you paste an example or snippet of code that doesn't work and your config files? Installing Debian packages on Ubuntu may be problematic as Debian releases software at a slower, more stable pace and some patches may not be included. I would also look at release notes of the applicable software in case something is deprecated or removed. As a last resort, you could install a virtual machine with a bridged network adapter if required.NuclearPeon

2 Answers

0
votes

A few things worth checking:

  • Run apache2ctl -M in the Ubuntu terminal and make sure you have cgi_module and include_module enabled.
  • Open your website configuration file for Apache and:
    • make sure that under the Options directive, you have ExecCGI, Includes and not IncludesNOEXEC
    • check that for the directories which have your CGI scripts, you have SetHandler cgi-script set, or are using the ScriptAlias directive.

As far as I know, it's not possible to run both SSI and CGI on the same source file. One can pre-generate the other before run time (like a pre-proccessor), or they can 'include' each other at run time as separate files.

SSI options for including CGI:

  • <!--#include virtual="/cgi-bin/example.cgi?argument=value" -->
  • <!--#exec cgi="/cgi-bin/example.cgi" -->
  • <!--#exec cmd="perl /path/to/perlscript arg1 arg2" -->

I hope something there helps.

0
votes

Add this to your .htaccess file:

<Files ~ ".ssicgi$">
    Options +SymLinksIfOwnerMatch +Includes
    AddOutputFilter INCLUDES .ssicgi
</Files>

rename the cgi scripts whose output you want parsed for cgi to the extension ".ssicgi" and rename any calls to the original scripts so it calls the filtered versions.

Make sure to upvote and accept the answer if this solves it for you.