http://www.perlmonks.org?node_id=1067957


in reply to CGI troubles for code that runs on both Windows and OpenSuse Linux 12,3

Regarding Apache. You can insure that .cgi, .pl scripts fire off (are executed by Perl) on a per-directory basis, by adding the following within the <Directory "/path/some/where"> sections

# Helps insure .cgi and .pl files are loaded MultiviewsMatch Handlers Filters AddHandler cgi-script cgi AddHandler cgi-script pl
But the following bits Options stanza, must also be enabled
Options Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI
Probably most importantly, the ExecCGI bit.
Probably of most concern to you, is your /cgi-bin Directory stanza, in Apache. Following is a complete block for it, that should provide for your needs
# ScriptAlias: This controls which directories contain server scri +pts. # ScriptAliases are essentially the same as Aliases, except that # documents in the target directory are treated as applications an +d # run by the server when requested rather than as documents sent t +o the # client. The same rules about trailing "/" apply to ScriptAlias # directives as to Alias. # # DO modify the following line "the second part" to # reflect the EXACT location of your cgi-bin directory -- I think it's # /var/www/cgi-bin, or /opt/... on Linux flavors. You'll need to check ScriptAlias /cgi-bin/ "/usr/local/www/cgi-bin/"
Make sure that you modify, or UNcomment the line in your httpd.conf. Do not simply add the one I've provided here. :)
Also note the Options ExecCGI must be enabled within the Directory section the line above lives in.
Last, but not least; The following line
LoadModule cgi_module libexec/apache22/mod_cgi.so
must exist within your "Dynamic Shared Object (DSO) Support" section. Yours may (probably) looks a little different, but it must exist, and must not be commented -- have a hash # at the beginning of it.

I realize this is a bit "choppy", and does not read like a book. But I've done so intentionally. As each section has a different meaning/affect, and will better help you discover which parts are pertinent to the problem you are having. While I don't use Apache. I did use it in it's very beginnings, when it was simply known as HTTPd. Given it was back then simply a "patched-up" version of NCSA -- NCSA HTTPd. It took on the name "Apache" -- or "A patch". Since then, I've written, and use my own HTTPd server.

Hope this helps, and best wishes.

--Chris

EDIT: almost forgot to note; in all cases, look for a file named .htaccess in any of your web folders. If it exists, you can make the changes, or comment # out any conflicting lines. It is probably always best to use the httpd.conf file, and not .htaccess. If for no other reason, because the server will run faster, and ultimately, causes less load on it.

Yes. What say about me, is true.