Perl-Skript wird nicht ausgeführt

mille

Erfahrenes Mitglied
Hallo Leute,

ich habe eine Umfrage-Software (Sawtooth Software) auf CGI-Basis, die bie mir partout nicht laufen möchte. Weder auf dem Windows 2008 Server (wo es am liebsten laufen sollte), nohc auf meinem localhost zum Testen. Beides auf XAMPP/ LAMPP Basis, wobei der Xampp auf dem Windows 2008 Server unseren Sicherheitsrichtlinien genügt.

Egal was ich tue, der Aufruf einer .pl Datei resultiert in einem Error 403 "Zugriff verweigert". Nach dem ich nun schon sehr lange herum probiert habe (und die httpd.conf editiert habe), habe ich heraus gefunden, dass die Ausführung eines Test-CGI Scripts (liegt ja einer xampp installation bei) nur dann erfolgt, wenn die Datei keine Endung hat. Sobald die Test-Cgi in test-cgi.pl umbenannt wird, geht nichts mehr: der Error 403 tritt auf.

Da die Umfrage-Software nicht verändert werden darf (und sollte), muss ich .pl Dateien zum Laufen bekommen. Das klappt nur nicht so recht. In der httpd.conf findet sich u.a. folgender Eintrag:

Code:
<IfModule alias_module>
    #
    # Redirect: Allows you to tell clients about documents that used to 
    # exist in your server's namespace, but do not anymore. The client 
    # will make a new request for the document at its new location.
    # Example:
    # Redirect permanent /foo http://www.example.com/bar

    #
    # Alias: Maps web paths into filesystem paths and is used to
    # access content that does not live under the DocumentRoot.
    # Example:
    # Alias /webpath /full/filesystem/path
    #
    # If you include a trailing / on /webpath then the server will
    # require it to be present in the URL.  You will also likely
    # need to provide a <Directory> section to allow access to
    # the filesystem path.

    #
    # ScriptAlias: This controls which directories contain server scripts. 
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the target directory are treated as applications and
    # run by the server when requested rather than as documents sent to the
    # client.  The same rules about trailing "/" apply to ScriptAlias
    # directives as to Alias.
    #
    ScriptAlias /cgi-bin/ "/opt/lampp/htdocs/cgi-bin/"

</IfModule>

und

Code:
<Directory "/opt/lampp/htdocs/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

sowie

Code:
<IfModule mime_module>
    #
    # TypesConfig points to the file containing the list of mappings from
    # filename extension to MIME-type.
    #
    TypesConfig etc/mime.types

    #
    # AddType allows you to add to or override the MIME configuration
    # file specified in TypesConfig for specific file types.
    #
    #AddType application/x-gzip .tgz
    #
    # AddEncoding allows you to have certain browsers uncompress
    # information on the fly. Note: Not all browsers support this.
    #
    #AddEncoding x-compress .Z
    #AddEncoding x-gzip .gz .tgz
    #
    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    #
    # AddHandler allows you to map certain file extensions to "handlers":
    # actions unrelated to filetype. These can be either built into the server
    # or added with the Action directive (see below)
    #
    # To use CGI scripts outside of ScriptAliased directories:
    # (You will also need to add "ExecCGI" to the "Options" directive.)
    #
    #AddHandler cgi-script .cgi
    # XAMPP, since LAMPP 0.9.8:
    AddHandler cgi-script .cgi .pl

    # For files that include their own HTTP headers:
    #AddHandler send-as-is asis

    # For server-parsed imagemap files:
    #AddHandler imap-file map

    # 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.)
    #
    # XAMPP
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
</IfModule>

Könnt ihr mir helfen? Zunächst reicht mir das Starten der Software lokal, da ich ungerne auf dem Produktivserver (Windows 2008 Server) herumspielen möchte. Erst, wenn ich den Fehler bzw. den Auslöser des Problems kenne, wage ich mich daran. Daher hier auch Linux Pfade, da der Localhost ein Ubuntu Linux ist.

Vielen Dank!

Grüße
mille
 
In der Directory-Direktive schaltest Du alle Optionen aus. Mach mal:

Code:
<Directory "/opt/lampp/htdocs/cgi-bin">
    AllowOverride None
    Options +ExecCGI
    AddHandler cgi-script .pl .cgi
    Order allow,deny
    Allow from all
</Directory>
 
Hallo renee,

vielen Dank für deine Hilfe!
Unter Ubuntu hab ich das Problem damit beseitigen können. Morgen probier ich mittels gleichen Tipp die Behebung am Windows 2008 Server aus.

Eine Rückmeldung folgt dann!

Grüße
mille
 
Hallo!

Denke daran dass Windows nicht Linux ist.
Du musst also entweder die "Shebang" in allen Scripten an die Windowsumgebung anpassen oder Apache beibringen wo er den Scriptinterpreter findet (httpd.conf --> "ScriptInterpreterSource registry" --> dazu muss der Registry aber bekannt sein wo sich Perl befindet).

Gruss Dr Dau
 
Hallo Leute,

hat alles bestens geklappt.
Vielen Dank.

Das Problem ist sowohl unter Linux als auch auf dem Windows Server 2008 behoben. Unter Windows musste nach der Shebang allerdings nicht der Pfad zum xampp/perl/bin angegeben werden, sondern eine andere Perl installation. Diese hat ihren Dienst dann auch nicht mit einem Error 500 quittiert.

Beste Grüße
mille
 
Zurück