I have a page site.shtml
on an Apache server in which I am trying to include a few CGI scripts, like so:
<p><pre><!--#include virtual="files/testfile" --></pre></p>
<p><pre><!--#include virtual="cgi-bin/randhtml.cgi"--></pre></p>
<p><pre><!--#include virtual="cgi-bin/echo.cgi" --></pre></p>
<p><pre><!--#include virtual="echo.cgi" --></pre></p>
<p><pre><!--#include virtual="cgi-bin/echo.cgi?test" --></pre></p>
In this case, files/testfile
is a text file, cgi-bin/randhtml.cgi
is a preinstalled CGI executable, and both instances of echo.cgi
are the script:
#!/bin/sh
echo $0;
echo $*;
All scripts have permissions set to 755 and can be executed from the shell, where they behave as expected (random output or echoing back arguments).
When I try to load the web page, the file and random script are executed correctly and I get the expected output. The echo scripts are not and I get a number of errors in the page:
This is a test text file.
random
An error occurred while loading this page.
An error occurred while loading this page.
An error occurred while loading this page.
The error log contains only:
unable to include "cgi-bin/echo.cgi" in parsed file /home1/user/public_html/site.shtml
unable to include "echo.cgi" in parsed file /home1/user/public_html/site.shtml
unable to include "cgi-bin/echo.cgi?test" in parsed file /home1/user/public_html/site.shtml
I've tested with various other scripts, both shell and perl, named .cgi and .pl (Apache is set up to handle both as CGI scripts), and all appear to give this error. I've double-checked the permissions and tried them with 777, to no avail. I've written the virtual paths as cgi-bin/
and /cgi-bin/
, neither works.
Is there some limitation I'm running into, a syntax error, or some strange server issue?