• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

[gelöst] frisches XAMPP - Internal Server Error bei CGIs

bigblue

Newbie
Hallo Boardler,

Brauche auch an dieser Stelle nochmal Hilfe.

Habe nun seit ca. 8 Monaten erfolgreich einen XAMPP laufen, erst mit Windows, jetzt will ich das ganze etwas vertiefen und bin auf Linux umgestiegen - dank XAMPP kein Problem :)

Nun mein Problem:
Erstmals versuche ich mich in der Programmierung von Perl / CGI Skripten.

Leider bekomme ich beim Aufruf eines Testskriptes nur folgendes geliefert:

Code:
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, xxx@xxx.xx and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.
Apache/2.0.54 (Unix) mod_ssl/2.0.54 OpenSSL/0.9.7g PHP/5.0.4 DAV/2 mod_perl/1.999.21 Perl/v5.8.6 Server at xxxxx.xxxxx.xxx Port 80

Das Skript:

Code:
#!/opt/lampp/bin/perl
print "Content-type: text/html\n\n";
print "Hallo Welt";

Das Skript sollte doch funktionieren oder? Habe es mit der Suchfunktion hier gefunden!

Achja, falls das eine Rolle spielt, der Server steht hinter einer Linux-Firewall (extra Rechner, gleichzeitig Router), also falls dafür extra Ports freigegeben werden müssen, sagt mir das bitte.

Ich hoffe ihr könnt mir helfen, Gruß, Alex
 
OP
B

bigblue

Newbie
Also in der /opt/lampp/logs/error_log steht beim Aufruf vom Skript test.pl über firefox 1.0.6:

Code:
[Thu Aug 04 10:43:30 2005] [error] [client 217.184.94.109] (13)Permission denied: exec of '/opt/lampp/htdocs/test.pl' failed
[Thu Aug 04 10:43:31 2005] [error] [client 217.184.94.109] Premature end of script headers: test.pl
[Thu Aug 04 10:43:32 2005] [error] [client 217.184.94.109] File does not exist: /opt/lampp/htdocs/favicon.ico

Ich glaub das mit dem favicon.ico gehört nicht dazu, wurde aber auch gemeldet.

edit: Kann es sein das mir nur der Zugriff verweigert wird? Weiß aber nich welchen chmod oder chown ich da jetzt drüberlaufen lassen muss...
 
OP
B

bigblue

Newbie
Also chmod 755 /opt/lampp/htdocs/test.pl bringt leider nichts!

Fehlermeldung im Browser:

Code:
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, xxxx@xxx.xx and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.
Apache/2.0.54 (Unix) mod_ssl/2.0.54 OpenSSL/0.9.7g PHP/5.0.4 DAV/2 mod_perl/1.999.21 Perl/v5.8.6 Server at xxxxx.xxxxx.xxx Port 80

Meldungen in /opt/lampp/logs/error_log:

Code:
217.184.94.109 - - [04/Aug/2005:11:00:51 +0200] "GET /test.pl HTTP/1.1" 500 701
217.184.94.109 - - [04/Aug/2005:11:00:51 +0200] "GET /favicon.ico HTTP/1.1" 404 372

Könnte es ein Firewall-Problem sein? Etwas anderes fällt mir nicht mehr ein... Oder muss ich noch was in der config ändern? CGI bezüglich wurde da nie was gemacht, ist ein jungfräulicher XAMPP...
 

snaewe

Hacker
Hast Du eine Zeile wie
Code:
AddHandler cgi-script .pl
in deiner httpd.conf ??

Ist ExecCGI für '/' erlaubt ?

Existiert '/opt/lampp/bin/perl' ?

/S
 
OP
B

bigblue

Newbie
Auszug aus der httpd.conf:

Code:
AddHandler cgi-script .cgi .pl

--> ist vorhanden

Etwas von ExecCGI hab ich nicht gelesen, wo sollte das stehen das es erlaubt ist?

Auszug aus /opt/lampp/bin:

Code:
lrwxrwxrwx   1 root root       9 Jun 22 07:34 perl -> perl5.8.6
-rwxr-xr-x   1 root root  853876 Jun 14 22:45 perl5.8.6

--> Eintrag perl existiert

Dann müsste es ja an diesem ExecCGI liegen? Aber wo überprüfe ich das?

Danke für deine Mühe bis jetzt! Gruß, Alex
 

snaewe

Hacker
In httpd.conf bei mir z.B.
Code:
<Directory /usr/lib/cgi-bin/>
   AllowOverride None
   Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
   Order allow,deny
   Allow from all
</Directory>
D.h. 'ExecCGI' ist in /usr/lib/cgi-bin' gesetzt (nicht in '/').

/S
 
OP
B

bigblue

Newbie
Ich habe nur diesen Eintrag hier gefunden, fand den aber recht interessant:

Code:
#
# "/opt/lampp/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/opt/lampp/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

Aber was von ExecCGI stand nirgendwo! Muss das evtl. hier mit rein?
 
OP
B

bigblue

Newbie
So sieht der Abschnitt jetzt aus:

Code:
# "/opt/lampp/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/opt/lampp/cgi-bin">
    AllowOverride None
    Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
</Directory>

Skript wurde ins Verzeichnis "/opt/lampp/cgi-bin" verschoben!

Aufruf über name.domain.net/cgi-bin/test.pl bringt aber immer noch den Error 500 :(
 

snaewe

Hacker
So langsam gehen mir die Ideen aus...
Zeig nochmal einen aktuellen Ausschnitt aus deiner error.log.

/S
 
OP
B

bigblue

Newbie
Also aktuelle /opt/lampp/logs/error_log bei einem Zugriff auf xxx.xxx.xxx/cgi-bin/test.pl

Code:
[Thu Aug 04 15:36:16 2005] [error] [client 213.6.111.112] (2)No such file or directory: exec of '/opt/lampp/cgi-bin/test.pl' failed
[Thu Aug 04 15:36:16 2005] [error] [client 213.6.111.112] Premature end of script headers: test.pl
[Thu Aug 04 15:36:26 2005] [error] [client 213.6.111.112] File does not exist: /opt/lampp/htdocs/favicon.ico

PS.: Ich mach die Domain deshalb unkenntlich, weil der Server wie gesagt noch frisch ist und macht sich bestimmt nicht so praktisch dann gleich noch die Angriffsadresse zu liefern...
 
OP
B

bigblue

Newbie
Danke Danke Danke! Ihr seid großartig! :D

Habe wie oc2pus gesagt hat dos2unix für test.pl ausgeführt.

Jetzt sehe ich keinen Error sondern:
Code:
Hallo Welt

ls -l /opt/lampp/cgi-bin/test.pl brachte:

Code:
-rwxr-xr-x  1 root root 78 Aug  4 15:48 /opt/lampp/cgi-bin/test.pl

Großen Dank an snaewe und oc2pus! :D
 

oc2pus

Ultimate Guru
bigblue schrieb:
Also chmod 755 /opt/lampp/htdocs/test.pl bringt leider nichts!

logisch oder ?
.. dein Server sucht das script ja auch hier:
Code:
[Thu Aug 04 15:36:16 2005] [error] [client 213.6.111.112] (2)No such file or directory: exec of '/opt/lampp/cgi-bin/test.pl' failed
 

snaewe

Hacker
Den Dank gebe ich weiter an oc2pus.
Ich habe lediglich gestochert, er hat zielgenau zugestochen...
Ich ziehe meinen Hut!
 
Oben