Hello All
I'm hoping someone has run it to a similar problem. I wrote a script and ran it thru my browser and it succeeded, however, when I ran it as a cron item, I get a segmentation fault. I think it has to do with timeout issue.
Please help.
here is a sample of the code I used.
#!/usr/local/bin/php -q
<?
include("datacon.php");
?>
<?
$MyNumber = 1;
while($MyNumber <=100)
{
//print ("$MyNumber")."<br>";
$HOST ="127.0.0.1"; // define variable for host address
$PORT=$MyNumber; // define variable for port#
$fp=fsockopen("$HOST", "$PORT", $errno, $errstr, 30);
if(!$fp){
//echo " port ".$PORT." is down"."<br>";
//echo "reason error number ".$errno.",".$errstr."<br>";
$query = "select IpAddress from Opnport where IpAddress = '$HOST' and PortNum = '$PORT' and UpDte is null";
$queryall = $query;
$resultall = MYSQL_QUERY($queryall);
$numberall = mysql_Numrows($resultall);
if($numberall >= 1) {
//echo "<p> $numberall Already Added</p>";
}
else{
$query = "INSERT INTO Opnport(IpAddress,PortNum,DnDate, DnTime, ErrNum,ErrString)
VALUES ('$HOST','$PORT',now(),now(),'$errno','$errstr')";
$queryall = $query;
$resultall = MYSQL_QUERY($queryall);
//$numberall = mysql_Numrows($resultall);
}
}else{
//echo " port ".$PORT." is UP"."<br>";
}
$MyNumber++;
}
?>