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:
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc.
If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.
include("dbopen.php"); <-- where's that?
How do you think we can try reproducing this if we don't know the
database we should apparently have created?
Previous Comments:
------------------------------------------------------------------------
[2005-09-12 23:32:43] javervandrel at yahoo dot com
The script that I provided is the exact script that i'm using. It is
complete. I'm using a real OS (windows). Basically i'm looping
through a bunch of different ports, for example the results of the
query would be
8000
8050
8060
8070.....
This fsockopen loop could happen 15 times, each time it closes itself
after getting the info, updates the DB, then does another instance of
the loop.
------------------------------------------------------------------------
[2005-09-12 23:30:21] [EMAIL PROTECTED]
a) Provide a _short_ but _complete_ example script
b) Try this on a real OS, like Linux
------------------------------------------------------------------------
[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