Code that never exits?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • simonc

    Code that never exits?

    I'm getting incoming emails to activate a PHP script, not web page
    requests - so I can't visibly see things with a browser.

    Is there any way I can detect if one of my PHP scripts never exits - either
    the script "crashes" or enters an infinite loop?

    Is there some sort of timeout value a server will place on a script, that it
    must complete execution by a certain time, or it gets stopped?

    And are there any questions I should be asking of my web hosting service
    i.e. "does your server know if a script has gone bad or has run for too
    long?"

    Thanks in advance,

    Simon.






  • simonc

    #2
    Re: Code that never exits?

    I found my answer:

    There is a default script execution time set to 30 seconds by php, at which
    point the script will stop processing and it will spit out an error.

    For more info check out the docs on the php function:

    set_time_limit


    "simonc" <no@email.com > wrote in message
    news:CVAob.1418 $Y26.1032098@ne ws2.news.adelph ia.net...[color=blue]
    > I'm getting incoming emails to activate a PHP script, not web page
    > requests - so I can't visibly see things with a browser.
    >
    > Is there any way I can detect if one of my PHP scripts never exits -[/color]
    either[color=blue]
    > the script "crashes" or enters an infinite loop?
    >
    > Is there some sort of timeout value a server will place on a script, that[/color]
    it[color=blue]
    > must complete execution by a certain time, or it gets stopped?
    >
    > And are there any questions I should be asking of my web hosting service
    > i.e. "does your server know if a script has gone bad or has run for too
    > long?"
    >
    > Thanks in advance,
    >
    > Simon.
    >
    >
    >
    >
    >
    >[/color]


    Comment

    • Randell D.

      #3
      Re: Code that never exits?


      "simonc" <no@email.com > wrote in message
      news:QWLob.1562 $Y26.1157872@ne ws2.news.adelph ia.net...[color=blue]
      > I found my answer:
      >
      > There is a default script execution time set to 30 seconds by php, at[/color]
      which[color=blue]
      > point the script will stop processing and it will spit out an error.
      >
      > For more info check out the docs on the php function:
      >
      > set_time_limit
      >
      >[/color]

      Simon,

      set_error_handl er() might help you too - if your scripts were timeing out,
      or abort for some reason or other, you can 'trap' the failure with your own
      custom made function (thus have it report elsewhere or write something to a
      log file or dump variables to a file helping you to debug things). Check
      the online PHP Manual under "Error Handling and Logging Functions"... there
      might be more tools to help you out there...

      randelld


      Comment

      • Daniel Bengs

        #4
        Re: Code that never exits?

        "simonc" <no@email.com > wrote in message news:<CVAob.141 8$Y26.1032098@n ews2.news.adelp hia.net>...[color=blue]
        > I'm getting incoming emails to activate a PHP script, not web page
        > requests - so I can't visibly see things with a browser.
        >
        > Is there any way I can detect if one of my PHP scripts never exits - either
        > the script "crashes" or enters an infinite loop?
        >
        > Is there some sort of timeout value a server will place on a script, that it
        > must complete execution by a certain time, or it gets stopped?
        >
        > And are there any questions I should be asking of my web hosting service
        > i.e. "does your server know if a script has gone bad or has run for too
        > long?"[/color]

        Another thing you can do is just make the script write to a logfile
        when the script is called and when the script is ready, and if there
        are any entries without the second log message then you know that the
        script didn't complete.

        Comment

        Working...