connection timing out even after setting set_ini or set_time_limit

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pedalpete
    New Member
    • Oct 2007
    • 109

    #1

    connection timing out even after setting set_ini or set_time_limit

    I've got some strange behavior happening on my server.

    I have a php page which runs a few processes to keep my db up to date and optomized.

    The process can take about 40 minutes to run.
    I've used the following to start my page
    The values I've set so high because I've been trying to give the processes lots of time to run, but that doesn't seem to really be working.
    Code:
    set_time_limit(0);
    
       header("Content-type: text/html; charset=utf-8");
    and I've also tried
    Code:
     
     error_reporting(E_ALL);
     ini_set('display_errors', false);
     ini_set("max_execution_time","50000");
       ini_set("memory_limit","100M");
       header("Content-type: text/html; charset=utf-8");
    it seems like about 10% of the time, everything runs smoothly. The other 90% of the time, the page times out after about 15 minutes.

    I'm wondering if it has something to do with the memory_limit. I've been looking for ways to clear the memory with PHP but everything I've read says you don't have to.

    Any ideas on why this process won't run completely?
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    How does it time-out?

    Is it a server message, like 405, or is it a client-side time-out?
    It's possible that your browser, or router, or proxy, or anything in between, is timing out if it doesn't get any new data for a while.

    Comment

    • pedalpete
      New Member
      • Oct 2007
      • 109

      #3
      Hi again Atli,

      The response I'm getting is
      "Connection Interupted
      The connection to the server was reset while the page was loading."

      I have been assuming that the server was resetting, and not my local connection.
      But maybe I'm wrong.

      Maybe there is a better way to run this on the server but trigger it from a webpage?

      Comment

      • pedalpete
        New Member
        • Oct 2007
        • 109

        #4
        My solution to this was to run the processes from the command line. but i was having huge issues getting the script to run from the command line.
        It didn't want to connect to the database, etc.

        So what I did was to just simply build a command line page which retrieved the php page via
        Code:
        $data = @implode("", file('http://localhost/process/updateDB.php'));
        It may not be the most efficient thing in the world, but it seems to be working :)

        Comment

        Working...