Ir al contenido


Foto

Problema con conexion abierta en php


  • Por favor identifícate para responder
No hay respuestas en este tema

#1 kevithoz

kevithoz

    Member

  • Miembros
  • PipPip
  • 29 mensajes

Escrito 09 septiembre 2014 - 05:40

hola amigos, bueno, hoy me encuentro desarrollando un chat, el cuál funciona con un archivo que mantiene una conexion abierta con el servidor hasta recibir un nuevo registro.. Resulta que en mi servidor local (xampp) el script funciona bien pero al subir los archivos a un servidor gratuito (hostinger.es) .. El servidor me manda un error de "the server responded with a status of 500 (Internal Server Error) " ..

Aquí les coloco el archivo httpush.php



delphi
  1. <?php
  2. require_once('clases/conect.php');
  3. set_time_limit(0); //Establece el número de segundos que se permite la ejecución de un script.
  4. $fecha_ac = isset($_POST['timestamp']) ? $_POST['timestamp']:0;
  5.  
  6. $sql="select * from mensajes";
  7. $res=mysql_query($sql);
  8. while($row=mysql_fetch_array($res))
  9. {
  10.     $row['timestamp']; 
  11. }
  12. $fecha_bd = $row['timestamp'];
  13.  
  14. while( $fecha_bd <= $fecha_ac )
  15. {
  16. $query3    = "SELECT timestamp FROM mensajes ORDER BY timestamp DESC LIMIT 1";
  17. $con      = mysql_query($query3 );
  18. $ro        = mysql_fetch_array($con);
  19.  
  20. usleep(100000);//anteriormente 10000
  21. clearstatcache();
  22. $fecha_bd  = strtotime($ro['timestamp']);
  23. }
  24.  
  25. $query      = "SELECT * FROM mensajes ORDER BY timestamp DESC LIMIT 1";
  26. $datos_query = mysql_query($query);
  27. while($row = mysql_fetch_array($datos_query))
  28. {
  29. $ar["timestamp"]          = strtotime($row['timestamp']);
  30. $ar["mensaje"]   = $row['mensaje'];
  31. $ar["id"]           = $row['id'];
  32. $ar["status"]            = $row['status'];
  33. $ar["tipo"]              = $row['tipo'];
  34. }
  35. $dato_json  = json_encode($ar);
  36. echo $dato_json;
  37. ?>



Espero que me puedan ayudar :c
  • 0




IP.Board spam blocked by CleanTalk.