Apache|Cause and Solution for the CGI Error "Options ExecCGI is off in this directory"
When running a CGI program (Perl script) in a browser, it did not execute correctly. After checking the Apache error log on CentOS 6 (/var/log/httpd/error_log), the following error message was recorded:
Options ExecCGI is off in this directory: /var/www/html/test.cgi
The error message contains "ExecCGI", so I searched for this directive in Apache's configuration file (/etc/httpd/conf/httpd.conf) and found the following section:
<Directory "/var/www/html">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options -Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
/etc/httpd/conf/httpd.conf did not include "ExecCGI" in the Options directive (the line with "Options -Indexes FollowSymLinks"). After adding "ExecCGI" and restarting the Apache service (/etc/rc.d/init.d/httpd restart), the error was resolved.
Before modification
Options -Indexes FollowSymLinks
After modification
Options -Indexes FollowSymLinks ExecCGI