CGIエラー「Options ExecCGI is off in this directory」の原因と解決方法
CGIプログラム(Perlプログラム)をブラウザで実行すると動作しないので、CentOS 6のApacheのエラーログ(/var/log/httpd/error_log)を確認すると、以下のようなエラーログが記録されていた。
Options ExecCGI is off in this directory: /var/www/html/test.cgi
エラーメッセージに記録されている「ExecCGI」をApacheの設定ファイル(/etc/httpd/conf/httpd.conf)で探すと以下のような記述があった。
<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の設定(「Options -Indexes FollowSymLinks」という記述がある箇所)に「ExecCGI」が書かれていなかったので、「ExecCGI」を追加し、Apacheのサービスを再起動(/etc/rc.d/init.d/httpd restart)することで、エラーは解消した。
《修正前》
Options -Indexes FollowSymLinks
《修正後》
Options -Indexes FollowSymLinks ExecCGI