Thursday, July 29th 2010, 1:25pm UTC+2

You are not logged in.

  • Login
  • Register

1

Sunday, December 4th 2005, 5:19pm

Problem mit einrichten von CGI?!

Hi,

mein Problem liegt daran, dass der httpd die Fehlermeldung Nr. 500 zurück gibt obwohl alle Benuzerrechte gesetzt sind und das CGI Module eigentlich funktionieren sollte. ?(
hier mal ein Ausschnitt aus meiner httpd.conf.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
LoadModule cgi_module modules/mod_cgi.so

ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
#
# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/var/www/cgi-bin">
    AllowOverride None
    Options +ExecCGI
      AddHandler cgi-script .cgi .pl
    Order allow,deny
    Allow from all
</Directory>

Das cgi-bin Verzeichnis hat die Rechte "777" und die test Datei hat die Rechte "755". Sie gehören beide dem User root und der Gruppe root.
Hier meine letzte Fehlermeldung.

Quoted


[Sun Dec 04 16:34:45 2005] [error] [client 84.145.218.195] (8)Exec format error: exec of '/var/www/cgi-bin/test' failed
[Sun Dec 04 16:34:45 2005] [error] [client 84.145.218.195] Premature end of script headers: test

... und hier das Test Script:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* browser.c */
#include <stdio.h>
#include <stdlib.h>

/* Die Kopfzeile eines Standard-HTML-Dokuments
 * titel: String, der als Titel erscheinen soll
 */
void print_html_header(char *titel) {
  printf("<html><head>\n");
  printf("<title>%s</title>\n",titel);
  printf("</head><body><pre>\n");
}

  /* Das Ende eines HTML-Dokuments */
void print_html_end(void) {
  printf("</pre></body></html>\n");
}

  /* Damit überhaupt ein HTML-Dokument ausgegeben wird */
void print_header(void) {
  printf("Content-Type: text/html\n\n");
}

int main(void) {
  char *p;

  print_header();
  print_html_header("Wer bin ich?");
  p = getenv("HTTP_USER_AGENT");
  if(p!=NULL) {
    printf("Sie browsen mit : %s\n", p);
  } else {
    printf("Konnte HTTP_USER_AGENT nicht ermitteln!\n");
  }

  print_html_end();
  return EXIT_SUCCESS;
}
Greetz Andi

Mod Dewey

CREAKTIF - Comes soon

Google ist dein Freund :D
  • Go to the top of the page

undefined

Super Moderator

Posts: 4,248

Location: Germany

2

Sunday, December 4th 2005, 7:09pm

Wenn es sich um einen Virtual Host handelt ist der Alias meist schon vergeben, dann verwende am besten Match.

PHP Source code

1
2
3
4
5
6
7
ScriptAliasMatch ^/cgi-bin(.*) /var/www/cgi-bin/$1
<Directory "/var/www/cgi-bin">
    AllowOverride Indexes FileInfo Authconfig
    Options +ExecCGI +Includes
    Order allow,deny
    Allow from all
</Directory>


Achte auch darauf das deine CGI Scripte mit den benutzer Rechten in breich von suexec liegen!
Herausfinden kannst du das mit:

PHP Source code

1
2
su 
/usr/sbin/suexec2 -V


PHP Source code

1
2
3
4
5
6
7
8
9
10
11
ScriptAlias /cgi-bin"/var/www/cgi-bin/"
ScriptAlias /perl"/var/www/cgi-bin/"
# SuexecUserGroup wwwrun www
<Directory "/var/www/cgi-bin">
    AllowOverride Indexes FileInfo Authconfig
    Options    +ExecCGI +Indexes +Includes -FollowSymlinks
    SetHandler cgi-script
    AddHandler cgi-script .cgi .pl
    Order allow,deny
    Allow from all
</Directory>
Undefined Behavior (undefiniertes Verhalten) bedeutet meistens etwas ungültiges.
PHP Katepart - Speichenrechner - .htpasswd - RPM XDG Tool - Kcmnvview - QTidy
  • Go to the top of the page

3

Sunday, December 4th 2005, 7:28pm

Hab keinen Virtual Host.
Das suexec2 existiert bei mir nicht. (Fedora Core 4)
?(
Greetz Andi

Mod Dewey

CREAKTIF - Comes soon

Google ist dein Freund :D
  • Go to the top of the page