PHP 4.0 Bug #5725: Resource hog.

From: Date: Fri, 21 Jul 2000 17:15:05 +0000
Subject: PHP 4.0 Bug #5725: Resource hog.
Groups: php.dev 
Request: Send a blank email to php-dev+get-25369@lists.php.net to get a copy of this message
From: marcelo@msm.cl Operating system: Nt 4 SP6 IIS4.0 PHP version: 4.0 Release Candidate 2 PHP Bug Type: Scripting Engine problem Bug description: Resource hog. Hello, I have a Win NT 4.0 which has SQL7.0 (with SQL service pack installed). Pentium III @ 450 Mhz with 256 in RAM Using PHP 4.0.1 Patch Level 2 I have the following problem WITH ANY TYPE OF CODE. Problem: After -navigating- the site for a few minutes the web server hangs. The php page which it hangs on is random. By hanging I mean the CPU jumps to 100%, ram to 200M taken and the Task manager shows inetinfo.exe taking up 98% of the CPU. At first I thought it was SQL related, so I comented the code that calls SQL and the problem occured again. I installed php3 and I have no problems. In the following code, the case default would be displayed. But when you would choose ANY of the options the system would go nuts. Hope this helps, and I apologize if I made some mistake while doing this report. <? function validacaracteres($bodytag) { $bodytag = str_replace("\'", "*", $bodytag); return($bodytag); } function conecta() { $connection = mssql_connect("back","sa"); mssql_select_db(bolsa); } switch ($accion) { Case 1: ?> <html> <head> </head> <body bgcolor="#cccccc"> <center><h3><b>Preguntas Frecuentes</b></h3></center> <br><br><br><br> <form name="formulario" action="./faq.php?accion=5" method="post"> <center><table> <tr><td>Pregunta</td><td>:</td> <td><input type="text" name="pregunta"></td></tr> <tr><td>Respuesta</td><td>:</td> <td><input type="text" name="respuesta"></td></tr> </table></center> <center> <input type="submit" value="OK" name="submit"> </center> </form> </body> </html> <? break; Case 2: conecta(); $sql = "SELECT id,pregunta,respuesta FROM faq;"; $res = mssql_query($sql); echo "<body bgcolor='#cccccc'>"; while ($row=mssql_fetch_array($res)) { echo "<center><table><tr>"; echo "<td>Pregunta</td><td>:</td>"; echo "<td>$row[1]</td></tr>"; echo "<tr><td>Respuesta</td><td>:</td>"; echo "<td>$row[2]</td></tr>"; echo "</table></center>"; echo "<center><table><tr>"; echo "<td><a href='./faq.php?id=$row[0]&accion=3'>Eliminar</a><td>"; echo "<td><a href='./faq.php?id=$row[0]&accion=4'>Modificar</a><td>"; echo "</table></center>"; } echo "</body>"; break; Case 3: conecta(); $sql = "DELETE FROM faq WHERE id='$id';"; $res = mssql_query($sql); Header("Location: http://192.168.1.24/bolsa/principal.php"); break; Case 4: conecta(); $sql = "SELECT id,pregunta,respuesta FROM faq WHERE id='$id';"; $res = mssql_query($sql); echo "<body bgcolor='#cccccc'>\n"; echo "<form name='formulario' action='./faq.php?accion=6' method='post'>\n"; if ($row=mssql_fetch_array($res)) { echo "<center>\n<table>\n<tr>"; echo "<td>Pregunta</td><td>:</td><td>"; echo "<input type='text' name='pregunta' value='$row[1]'>"; echo "</td></tr>\n<tr><td>Respuesta</td><td>:</td><td>"; echo "<input type='text' name='respuesta' value='$row[2]'>"; echo "</td></tr>\n</table></center>"; } echo "<center>"; echo "<input type='hidden' name='id' value='$id'>"; echo "<input type='submit' value='OK' name='submit'>"; echo "<input type='reset' value='Limpiar' name='reset'>"; echo "</center>"; echo "</form>"; echo "</body>"; break; Case 5: conecta(); $pregunta=validacaracteres($pregunta); $respuesta=validacaracteres($respuesta); $sql = "INSERT INTO faq (pregunta,respuesta) VALUES ('$pregunta','$respuesta');"; $res = mssql_query($sql); Header("Location: http://192.168.1.24/bolsa/principal.php"); break; Case 6: conecta(); $pregunta=validacaracteres($pregunta); $respuesta=validacaracteres($respuesta); $sql = "UPDATE faq SET pregunta='$pregunta',respuesta='$respuesta' WHERE id='$id';"; $res = mssql_query($sql); Header("Location: http://192.168.1.24/bolsa/principal.php"); break; Default: ?> <html> <head> </head> <body bgcolor="#cccccc"> <center><h3><b>Preguntas Frecuentes</b></h3></center> <br><br><br><br> <form name="formulario" action="./faq.php"> <center> <select name="accion" size="1"> <option value="0" selected>Opciones</option> <option value="1">Agregar</option> <option value="2">Modificar</option> </select> <input type="submit" value="OK" name="submit"> </center> </form> </body> </html> <? } ?>

« previous php.dev (#25369) next »