Laufen ein .exe-Datei auf den apache?

Ich versuche zum ausführen eines cgi-ausführbare Datei über ein html-Formular, wie in diesem code:

 <html>

 <head>
<title>CGI Form</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
</head>

<body>
<form action="C:\WWW\cgi-bin\y.exe" method="get">
    <input type="text" name="string1" />
    <input type="text" name="string2" />
    <input type="text" name="string3" />
    <input type="submit" name="submit" value="Submit" />
</form>
</body>

</html>

Und hier ist es das cgi-code kompiliert y.exe und gespeichert in der angegebenen Pfad in die Aktion:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
char *buffer, string1[100], string2[100], string3[100], merged[300]; 

buffer = getenv("QUERY_STRING"); 

if(buffer == NULL) 
{
    printf("<p>Error: No data</p>");
}
else
{
    if(sscanf(buffer, "string1=%s&string2=%s&string3=%s", string1, string2, string3) !=      3) 
    {
        printf("Data missing!");
    }
    else
    {   
        strcpy(merged, string1); 
        strcat(merged, string2); 
        strcat(merged, string3); 

        printf("Content-Type: text/html\n\n");
        printf("<html>\n"
               "<head>\n"
                   "<title>CGI Form Merge Strings</title>\n"
               "</head>\n"
               "<body>\n"
                   "Merged string is: %s\n"
               "</body>\n"
               "</html>\n", merged);  
    }
}

return 0;

}

Ich habe versucht, konfigurieren Sie den httpd.conf-Datei mit dieser:

AddHandler cgi-script .exe
ScriptAlias /cgi-bin/"C:/WWW/cgi-bin/"

und

<Directory "C:/WWW/cgi-bin">
    AllowOverride All
    Options +ExecCGI
    Options FollowSymLinks 
    Require all granted
    AddHandler cgi-script .cgi
    AddHandler cgi-script .exe
</Directory>

Das bedeutet jedoch nicht, das problem zu beheben.

  • Ist das cgi-Modul geladen-apache? Stellen Sie sicher, dass diese Zeile ist nicht auskommentiert: LoadModule cgi_module modules/mod_cgi.so
  • Nein, es ist nicht kommentiert. Id stimmt nicht mit #beginnen.
Schreibe einen Kommentar