Mein Servercheckscript läuft nicht !!!

Alles, was Perl betrifft, kann hier besprochen werden.

Mein Servercheckscript läuft nicht !!!

Postby TrippleEx » 02. March 2006 01:45

Hallo Leute,


hab hier Servercheckscript, der läuft irgendwie nicht.
Der Pfad ist wie unten eingestellt!
Habe das gezippte "XAMPP Windows 1.5.1" laufen.
Alle sicherheitseinstellungen von XAMPP sind eingestellt.
Habe WinXP Prof inkl. SP2.

Code: Select all
#!\xampp\perl\bin\perl.exe
#################################
#
#    K+B-Bestellsystem V2.3.2
#        *Server-Check*
#                   
#  (c)2004 by amensa EDV-Service
#       Stefan Carstensen
#
#     Infos www.xxxxxx.de
#     Mail info@xxxxxx.de
#
#################################
use Socket;
use Config;
use Cwd;
require File::Find;
import File::Find;

$currentkbbversion = "2.3.2";
$produkt = "K+B-Bestellsystem";
$scriptname = 'servercheck.cgi';
read(STDIN, $input, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $input);foreach $pair (@pairs) {($name, $value) = split(/=/, $pair);
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;}@vars = split(/&/, $ENV{QUERY_STRING});
foreach $var (@vars) {($v,$i) = split(/=/, $var);
$v =~ tr/+/ /;
$v =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$i =~ tr/+/ /;$i =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$i =~ s/<!--(.|\n)*-->//g;$INFO{$v} = $i;}$action = $INFO{'action'};
$currentdir = getcwd();
######
if($action eq ""){
&start;
}
elsif ($action eq "check"){
&check;
}
elsif ($action eq "check_mime"){
&checkmime;
}
elsif ($action eq "check_lwp"){
&checklwp;
}
elsif ($action eq "all_modules"){
&allmodules;
}
elsif ($action eq "module_info"){
&moduleinfo;
}
######
sub checkdata {
if ($^O !~ /win/i) {
foreach ("/bin/sendmail",
"/sbin/sendmail",
"/usr/bin/sendmail",
"/usr/lib/sendmail",
"/usr/share/sendmail",
"/usr/sbin/sendmail",
"/usr/bin/sendmail.restart",
"/etc/sendmail.cf",
"/etc/sendmail.cw",
"/usr/man/man8/sendmail.8",
"/var/qmail/bin/qmail-inject"){

if(-e $_ && -X _){
$sendmail .= "$_<br>";
}
}
if($currentperl eq "" && (-e("/usr/bin/perl"))) {
$currentperl = "/usr/bin/perl";
}
if($whois eq "" && (-e("/usr/bin/whois"))){
$currentwhois = "/usr/bin/whois";
}
##
if ($currentperl =~ /[a-z]/) {
$ok_perl = "ok";
} else {
$ok_perl = "not ok";
}
if ($sendmail =~ /[a-z]/) {
$ok_sendmail = "ok";
} else {
$ok_sendmail = "not ok";
}
if ($currentwhois =~ /[a-z]/) {
$ok_whois = "ok";
} else {
$ok_whois = "not ok";
}

foreach my $key (@INC) {
$INC .= "$key<br>";
}
######
sub module {
    if($File::Find::name =~ /\.pm$/){
    open(DATA,$File::Find::name) || return;
    $p = 0;
    while(<DATA>){
    if(/^ *package +(\S+);/){
    $module_name=$1;
    $mod{$module_name}="?";
    $p = 1;
    }
    if(/^.*?VERSION *= *('|"|\sv)?([\d.]+)((.*);|('|")?;)/i and $p){
    if($2){$mod{$module_name}=$2;}
    last;
    }
    }
    close(DATA);
    }
}

$mod_file = "1";
    if($mod_file){
    find(\&module, @INC);
    @keys = sort { lc($a) cmp lc($b)} keys %mod;
    foreach (@keys) {
    $cpt++;
    $mod{$_}='?' unless defined $mod{$_};
    $modules .= qq~<font face="Arial" size="2"><a href="$scriptname?action=module_info&module=$_" target="_blank">$_</a></font> <font face="Arial" size="2">Version $mod{$_}</font><br>~;
    $modulescount++;
    }
}
##
foreach (sort { lc($a) cmp lc($b)} @INC){
     chomp;
     $modules .= $_ . "<br>";
}
##
}
}
######
sub moduleinfo {
    print "Location: http://search.cpan.org/search?module=$INFO{'module'}\n\n";exit(0);
}
######
sub checkmime {
    $checkmname = "MIME::Entity";
    $mimefound .= qq~<h1><font color=green>Modul <a href="$scriptname?action=module_info&module=$checkmname" target="_blank">$checkmname</a> gefunden!</font></h1>~;
    $mimenotfound .= qq~<h1><font color=red>Modul <a href="$scriptname?action=module_info&module=$checkmname" target="_blank">$checkmname</a> nicht vorhanden oder nicht richtig installiert!</font></h1>~;
    eval { $died_in_eval = 1; require MIME::Entity; };
    if ($@) {
    print "Content-Type: text/html\n\n";
    print "$mimenotfound";
    }
    else {
    import MIME::Entity;
    print "Content-Type: text/html\n\n";
    print "$mimefound";
    }
}
######
sub checklwp {
    $checkmname = "LWP::Simple";
    $lwpfound .= qq~<h1><font color=green>Modul <a href="$scriptname?action=module_info&module=$checkmname" target="_blank">$checkmname</a> gefunden!</font></h1>~;
    $lwpnotfound .= qq~<h1><font color=red>Modul <a href="$scriptname?action=module_info&module=$checkmname" target="_blank">$checkmname</a> nicht vorhanden oder nicht richtig installiert!</font></h1>~;
    eval { $died_in_eval = 1; require LWP::Simple; };
    if ($@) {
    print "Content-Type: text/html\n\n";
    print "$lwpnotfound";
    }
    else {
    import LWP::Simple;
    print "Content-Type: text/html\n\n";
    print "$lwpfound";
    }
}
######
sub start {
print "Content-Type: text/html\n\n";
print<<"Html1";
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<title>..:: Server-Check K+B-Bestellsystem-V$currentkbbversion ::..</title>
</head>
<body bgcolor="#BFEFFF" style="font-family: Arial">
<div align="center">
<center>
<table border="2" cellspacing="0" width="519" bordercolor="#0054A8" bordercolorlight="#0054A8" bordercolordark="#0054A8">
<tr>
<td width="547">
<form action="$scriptname?action=check" method="post">
<table border="0" cellspacing="0" cellpadding="2" width="521" height="549">
<tr>
<td bgcolor="#003366" width="515" height="516" valign="top">
<p align="center"><font color="#FFFFFF" size="4"><b>&nbsp;<br>
</b></font><font size="4" color="#BFEFFF">
Server-Check $produkt-V$currentkbbversion</font><hr color="#FFFFFF" size="1">
<div align="center">
  <table border="0" cellspacing="0" width="99%" cellpadding="0">
    <tr>
      <td width="100%" bgcolor="#0054A8">
        <div align="center">
          <table border="0" cellspacing="1" width="100%" height="424">
            <tr>
              <td width="100%" bgcolor="#BFEFFF" height="18"><b><font size="2">Info</font></b></td>
            </tr>
            <tr>
              <td width="100%" bgcolor="#FFFFFF" height="398" valign="top"><font size="2">Mit
  diesem Script können Sie ganz schnell prüfen, ob Ihr Server bereits über die Systemanforderungen
  für unser Produkt <b> $produkt</b>&nbsp;verfügt.<br>
                Um den Test zu starten, klicken Sie einfach unten auf&nbsp;<span style="background-color: #BFEFFF">
                Server-Check starten!&nbsp;</span></font>
                <p><font size="2">&nbsp;Weitere Informationen zu unseren
                Produkten finden Sie auf:</font></p>
                <p align="center"><font size="2">&nbsp;<a href="http://www.amensa-soft.de" target="_blank">http://www.amensa-soft.de</a></font></p>
              </td>
            </tr>
          </table>
        </div>
      </td>
    </tr>
  </table>
</div>
<hr color="#FFFFFF" size="1">
<p align="center">
<font size="1">&nbsp;</font><font color="#ffffff" size="1">© 2001-2004 by </font><a href="http://www.amensa-soft.de"><font color="#ffffff" size="1">amensa-soft.de</font></a>
</td>
</tr>
</center>
<center>
<tr>
<td bgcolor="#0054A8" align="center" width="515" height="25"><font size="2"><input type="submit" value="Server-Check starten!" style="background-color: #BFDFFF; border: 1 solid #003366"></font></td>
</tr>
</table>
</center>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
Html1
}
######
sub check {
&checkdata;
print "Content-Type: text/html\n\n";
print<<"Html2";
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<title>..:: Server-Check K+B-Bestellsystem-V$currentkbbversion ::..</title>
</head>
<body bgcolor="#BFEFFF" style="font-family: Arial">
<div align="center">
<center>
<table border="2" cellspacing="0" width="519" bordercolor="#0054A8" bordercolorlight="#0054A8" bordercolordark="#0054A8">
<tr>
<td width="547">
<form action="$scriptname" method="post">
<table border="0" cellspacing="0" cellpadding="2" width="521" height="152">
<tr>
<td bgcolor="#003366" width="515" height="261" valign="top">
<p align="center"><font color="#FFFFFF" size="4"><b>&nbsp;<br>
</b></font><font size="4" color="#BFEFFF">
Server-Check $produkt-V$currentkbbversion</font><hr color="#FFFFFF" size="1">
<div align="center">
  <table border="0" cellspacing="0" width="99%" cellpadding="0">
    <tr>
      <td width="100%" bgcolor="#0054A8">
        <div align="center">
          <table border="0" cellspacing="1" width="507" height="295" cellpadding="3">
            <tr>
              <td width="499" bgcolor="#FFFFFF" colspan="3" height="18"><b><font size="2">Systemanforderungen</font></b></td>
            </tr>
            <tr>
      <td width="128" bgcolor="#BFEFFF" height="18"><font size="2">Perl*</font></td>
      <td width="268" bgcolor="#BFEFFF" height="18"><font SIZE="2">$currentperl</font></td>
      <td align="center" bgcolor="#BFEFFF" height="18" width="91"><font size="2">$ok_perl</font></td>
            </tr>
            <tr>
      <td width="128" bgcolor="#FFFFFF" height="18"><font size="2">Sendmail*</font></td>
      <td width="268" bgcolor="#FFFFFF" height="18"><font size="2">$sendmail</font></td>
      <td align="center" bgcolor="#FFFFFF" height="18" width="91"><font size="2">$ok_sendmail</font></td>
            </tr>
            <tr>
      <td width="128" bgcolor="#BFEFFF" height="18"><font size="2">Whois*</font></td>
      <td width="268" bgcolor="#BFEFFF" height="18"><font size="2">$currentwhois</font></td>
      <td align="center" bgcolor="#BFEFFF" height="18" width="91"><font size="2">$ok_whois</font></td>
            </tr>
            <tr>
      <td width="128" bgcolor="#FFFFFF" height="20">&nbsp;</td>
      <td width="268" bgcolor="#FFFFFF" height="20">&nbsp;</td>
      <td align="center" bgcolor="#FFFFFF" height="20" width="91">&nbsp;</td>
            </tr>
            <tr>
      <td width="128" bgcolor="#BFEFFF" height="18"><font size="2">MIME::Entity*</font></td>
      <td width="268" bgcolor="#BFEFFF" height="18"><font size="2">
        <a href="$scriptname?action=check_mime" target="_blank"><b><span style="letter-spacing: -2pt">&gt;&gt;</span>Modul
        jetzt prüfen<span style="letter-spacing: -2pt">&lt;&lt;</span></b></a></font></td>
      <td align="center" bgcolor="#BFEFFF" height="18" width="91"><font size="2">?</font></td>
            </tr>
            <tr>
      <td width="128" bgcolor="#FFFFFF" height="18"><font size="2">LWP::Simple**</font></td>
      <td width="268" bgcolor="#FFFFFF" height="18"><font size="2"><a href="$scriptname?action=check_lwp" target="_blank"><b><span style="letter-spacing: -2pt">&gt;&gt;</span>Modul
        jetzt prüfen<span style="letter-spacing: -2pt">&lt;&lt;</span></b></a></font></td>
      <td align="center" bgcolor="#FFFFFF" height="18" width="91"><font size="2">?</font></td>
            </tr>
            <tr>
      <td width="499" colspan="3" height="65" valign="top" bgcolor="#BFEFFF">&nbsp;&nbsp;
        <font size="1">* Muss ok sein&nbsp;&nbsp;&nbsp;</font>
        <p><font size="1">&nbsp; ** Modul ist optional </font></p>
      </td>
            </tr>
            <tr>
      <td width="499" bgcolor="#FFFFFF" colspan="3" height="18"><font size="2"><b>Informationen</b></font></td>
            </tr>
            <tr>
      <td width="128" bgcolor="#BFEFFF" height="12"><font size="2">Modul-Verzeichnisse</font></td>
      <td width="365" bgcolor="#BFEFFF" height="12" colspan="2"><font size="2">$INC</font></td>
            </tr>
            <tr>
      <td width="128" bgcolor="#FFFFFF" height="28"><font size="2">Serverpfad
        zur servercheck.cgi&nbsp;</font></td>
      <td width="365" bgcolor="#FFFFFF" height="28" colspan="2"><font size="2">$currentdir</font></td>
            </tr>
            <tr>
      <td width="128" bgcolor="#BFEFFF" height="12"><font size="2">Anzahl Module</font></td>
      <td width="365" bgcolor="#BFEFFF" height="12" colspan="2"><font size="2">$modulescount Module
        wurden gefunden<br>
 <a href="$scriptname?action=all_modules" target="_blank"><b><span style="letter-spacing: -2pt">&gt;&gt;</span>alle
        Module anzeigen<span style="letter-spacing: -2pt">&lt;&lt;</span></b></a></font></td>
            </tr>
          </table>
        </div>
      </td>
    </tr>
  </table>
</div>
<hr color="#FFFFFF" size="1">
</td>
</tr>
</center>
<center>
<tr>
<td bgcolor="#003366" width="515" height="1" valign="top">
<p align="center"><font color="#ffffff" size="1">© 2001-2004 by </font><a href="http://www.amensa-soft.de"><font color="#ffffff" size="1">amensa-soft.de</font></a>
</td>
</tr>
<tr>
<td bgcolor="#0054A8" align="center" width="515" height="25"><font size="2"><input type=button value="zurück" style="background-color: #BFDFFF; border: 1 solid #003366" onclick="history.back()"></font></td>
</tr>
</table>
</center>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
Html2
}
######
sub allmodules {
&checkdata;
print "Content-Type: text/html\n\n";
print<<"Html3";
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<h2><font face="Arial" color="#C0C0C0">Folgende Module wurden gefunden</font></h2>
<script language="JavaScript">
var NS4 = (document.layers);    // Which browser?
var IE4 = (document.all);
var win = window;    // window to search.
var n   = 0;
function findInPage(str) {
var txt, i, found;
if (str == "")
return false;
// Find next occurance of the given string on the page, wrap around to the
// start of the page if necessary.
if (NS4) {
// Look for match starting at the current point. If not found, rewind
// back to the first match.
if (!win.find(str))
while(win.find(str, false, true))
n++;
else
n++;
// If not found in either direction, give message.
if (n == 0)
alert("Not found.");
}
if (IE4) {
txt = win.document.body.createTextRange();
// Find the nth match from the top of the page.
for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
txt.moveStart("character", 1);
txt.moveEnd("textedit");
}
// If found, mark it and scroll it into view.
if (found) {
txt.moveStart("character", -1);
txt.findText(str);
txt.select();
txt.scrollIntoView();
  n++;
  }
// Otherwise, start over at the top of the page and find first match.

else {
if (n > 0) {
n = 0;
findInPage(str);
}
// Not found anywhere, give message.
else
alert("Module not found!");
}
}
return false;
}
</script>

<form name="search" onSubmit="return findInPage(this.string.value);">
<input name="string" type="text" size=20 onChange="n = 0;">
<input type="submit" value="search">
</form>
$modules
Html3
};



Bekomme den Fehler:

Code: Select all
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, admin@localhost 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.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.


--------------------------------------------------------------------------------

Apache/2.2.0 (Win32) DAV/2 mod_ssl/2.2.0 OpenSSL/0.9.8a mod_autoindex_color PHP/5.1.1 Server at localhost Port 80



Was verdammt nochmal mache ich falsch !??
TrippleEx
 
Posts: 13
Joined: 19. June 2005 13:35

Postby Wiedmann » 02. March 2006 01:59

Bekomme den Fehler:

Nur allgemein:
Viel interessanter als Standard-Browsermeldungen ist das "error.log" vom Apache.

Was verdammt nochmal mache ich falsch !??

Du hast kein komplettes Perl, z.B. das XAMPP Perl-AddOn, installiert.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby TrippleEx » 02. March 2006 11:11

Danke für die schnelle Antwort.

Bekomme den Fehler:

Nur allgemein:
Viel interessanter als Standard-Browsermeldungen ist das "error.log" vom Apache.

Code: Select all
[Thu Mar 02 01:36:42 2006] [notice] Server built: Dec  1 2005 18:36:53
[Thu Mar 02 01:36:42 2006] [notice] Parent: Created child process 3972
[Thu Mar 02 01:36:43 2006] [notice] Child 3972: Child process is running
[Thu Mar 02 01:36:43 2006] [notice] Child 3972: Acquired the start mutex.
[Thu Mar 02 01:36:43 2006] [notice] Child 3972: Starting 250 worker threads.
[Thu Mar 02 01:36:43 2006] [notice] Child 3972: Starting thread to listen on port 443.
[Thu Mar 02 01:36:43 2006] [notice] Child 3972: Starting thread to listen on port 80.
[Thu Mar 02 01:44:12 2006] [error] [client 127.0.0.1] Premature end of script headers: servercheck.cgi
[Thu Mar 02 01:44:12 2006] [error] [client 127.0.0.1] Can't locate Socket.pm in @INC (@INC contains: .) at G:/xampp/cgi-bin/servercheck.cgi line 14.\r
[Thu Mar 02 01:44:12 2006] [error] [client 127.0.0.1] BEGIN failed--compilation aborted at G:/xampp/cgi-bin/servercheck.cgi line 14.\r


Was verdammt nochmal mache ich falsch !??

Du hast kein komplettes Perl, z.B. das XAMPP Perl-AddOn, installiert

Ich "XAMPP Windows 1.5.1" entzippt. Wenn ich versuche den Perl-AddOn zu installieren, bekomme ich folgenden fehlermeldung.

XAMPP win32 not found. Unable to get Install path.

Bedeutet das, das ich die installvariante von XAMPP benutzen muss um das Perl AddOn zu benutzen!!![/code]
TrippleEx
 
Posts: 13
Joined: 19. June 2005 13:35

Postby TrippleEx » 02. March 2006 13:49

Hab jetzt auchmal das gezppte Perl AddOn in Verzeichnis des von XAMPP entpackt und die "setup_xampp.bat" ausgeführt.

Nun bekomme ich die fehlermeldung:

Image


Meine Frage an das Entwickler Team, hat dieses Perl AddOn überhaupt mal gefuntzt?

Habs nämlich auch schon mit der Installations Variante versucht, ebenfalls erfolglos !
TrippleEx
 
Posts: 13
Joined: 19. June 2005 13:35

Postby Wiedmann » 02. March 2006 14:18

Meine Frage an das Entwickler Team, hat dieses Perl AddOn überhaupt mal gefuntzt?

Keine Ahnung. Schreib halt eine Mail an Kay Vogelsang ;-)

Du kannst dir aber auch einfach das ActivePerl von ActiveState installieren.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby TrippleEx » 02. March 2006 15:59

Code: Select all
[Thu Mar 02 15:56:58 2006] [crit] (22)Invalid argument: unable to replace stderr with error_log
[Thu Mar 02 15:56:58 2006] [crit] (2)No such file or directory: unable to replace stderr with /dev/null
[Thu Mar 02 15:57:01 2006] [error] Can't load Perl file: G:/xampp/apache/conf/extra/startup.pl for server localhost:80, exiting...


der fehler sieht in der apache.log so aus.
TrippleEx
 
Posts: 13
Joined: 19. June 2005 13:35


Return to Perl

Who is online

Users browsing this forum: No registered users and 3 guests