Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Httpd Wiki" for change 
notification.

The following page has been changed by mcadoo:
http://wiki.apache.org/httpd/CGI

New page:
I configured the apache2 web server to execute a Perl script from a designated 
directory with the following:

{{{
    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
    <Directory "/var/www/cgi-bin/">
                Options ExecCGI -Indexes
                AddHandler cgi-script .cgi .pl
    </Directory>
}}}
But every time I accessed the script through the web browser I was presented 
with a download dialog box.
I examined the apache configuration and made all kinds of changes but nothing 
helped.
Until I finally noticed the following:

The original Perl script is as follows:

{{{
    #!/usr/bin/perl
    print "Content-type: test/plain\n\n";
    print "It's working.\n";
}}}
The problem is that the second line has the word test in it when it should be 
"text"
Changing the word test to text made everything work.

I found other questions regarding this same behavior.
Since this was a frustrating problem I submit this tip in the hope that it will 
save someone some time 
and frustration.

Reply via email to