无法在Apache服务器中运行CGI脚本

时间:2017-10-11 20:55:11

标签: php apache web cgi

所以我一直在尝试从htdoc目录运行带有.exe扩展名的CGI脚本,这些脚本也运行PHP脚本。但我无法获得正确的配置。 这是我的httpd.conf

#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other 
# <Directory> blocks below.
#

<Directory "/home/*/public_html/cgi-bin">
    Options ExecCGI
    SetHandler cgi-script
</Directory>

#<Directory />
#   Options Indexes FollowSymLinks Includes ExecCGI
#    AllowOverride All
 #   #Order deny,allow
 #   Allow from all
    #AllowOverride none
    #Require all denied
#</Directory>



DocumentRoot "c:/Apache24/htdocs"
<Directory "c:/Apache24/htdocs">
    #
    # 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.4/mod/core.html#options
    # for more information.
    #

    AddHandler cgi-script .cgi .pl
    Options Indexes FollowSymLinks ExecCGI
   # Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride All



    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>


    #
    # ScriptAlias: This controls which directories contain server scripts. 

    ScriptAlias /cgi-bin/ "c:/Apache24/cgi-bin/"

</IfModule>

<IfModule cgid_module>
    #
    # ScriptSock: On threaded servers, designate the path to the UNIX
    # socket used to communicate with the CGI daemon of mod_cgid.
    #
    #Scriptsock cgisock
</IfModule>

#
# "c:/Apache24/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "c:/Apache24/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>


    <Directory "c:/Apache24/htdocs">
        Options +ExecCGI
    </Directory>

    AddHandler cgi-script .cgi .exe
    # For type maps (negotiated resources):
    #AddHandler type-map var

    #
    # Filters allow you to process content before it is sent to the client.
    #
    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add "Includes" to the "Options" directive.)
    #
    #AddType text/html .shtml
    #AddOutputFilter INCLUDES .shtml



LoadModule php7_module "c:/php7/php7apache2_4.dll"
<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>


PHPIniDir "C:/php7"

为了使它有效,我应该改变什么? 我不得不删除不相关的东西,因为stackoverflow没有让我发布整个文件。

0 个答案:

没有答案