ID: 34483
Updated by: [EMAIL PROTECTED]
Reported By: javervandrel at yahoo dot com
-Status: Open
+Status: Feedback
Bug Type: Apache2 related
Operating System: Windows 2000 Server
PHP Version: 5.0.5
New Comment:
a) Provide a _short_ but _complete_ example script
b) Try this on a real OS, like Linux
Previous Comments:
------------------------------------------------------------------------
[2005-09-12 20:38:42] javervandrel at yahoo dot com
Description:
------------
I'm writing a script that checks a MYSQL database for all ports that
are currently assigned for shoutcast, then in a loop I'm opening each
of those connections, pulling the data on the stream (is it
broadcasting, if so what is the song title). Then I'm updating that
row in the DB with the appropriate info. The script works, but every
24 hours or sometimes less the mysqli functions stop working, DB
connections stop working, the only way to solve this is to STOP apache,
wait a few seconds then start again (Restarting does not work, must be
stop, wait, then start). I cant find anybody out there having similar
issues at all. I tried using PHP 4.3+, 5.0+, and now 5.1 RC1, and it
still happens. Any help is greatly appreciated, thanks!
Reproduce code:
---------------
function sc_status($server, $port, $file)
{
$cont = "";
$fp = fsockopen($server, $port, $errno, $errstr, 1);
if (!$fp)
{
fclose($fp);
return-2;
}
else
{
$com = "GET $file HTTP/1.1\r\nAccept: */*\r\nAccept-Language:
de-ch\r\nAccept-Encoding: gzip, deflate\r\nUser-Agent: Mozilla/4.0
(compatible; MSIE 6.0; Windows NT 5.0)\r\nHost:
$server:$port\r\nConnection: Keep-Alive\r\n\r\n";
fputs($fp, $com);
while (!feof($fp))
{
$cont .= fread($fp, 500);
}
fclose($fp);
$cont = substr($cont, strpos($cont, "\r\n\r\n") + 4);
}
fclose($fp);
$parts = explode(',', $cont);
return $parts;
}
include("dbopen.php");
$query="select port, name, username, id from djlist order by id DESC";
$stations=mysqli_query($chandle,$query);
echo "STARTS HERE<br><br>";
while(($temprow=mysqli_fetch_row($stations)) && ($continue != 6))
{
$port=$temprow['0'];
$name=$temprow['1'];
$uname=$temprow['2'];
$id=$temprow['3'];
$value=sc_status('localhost', $port, '/7.html');
$song=$value['6'];
$online=$value['1'];
if($song == "</body></html>")
$online = 0;
if($online != 0)
{
echo $song."<br>";
$query="UPDATE djlist set song='".$song."', online=1 where
id=$id";
mysqli_query($chandle,$query);
}
else
{
$query="UPDATE djlist set online=0 where id=$id";
mysqli_query($chandle,$query);
}
}
mysqli_close($chandle);
Expected result:
----------------
STARTS HERE
Chamillionaire - Turn It Up
Elton John - Have Mercy On The Criminal
done
Actual result:
--------------
Unable to connect to Database.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34483&edit=1