Professional Web Applications Themes

Code that never exits? - PHP Development

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 ...

  1. #1

    Default 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 Guest

  2. #2

    Default 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" <noemail.com> wrote in message
    news:CVAob.1418$Y26.1032098news2.news.adelphia.ne t...
    > 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 Guest

  3. #3

    Default Re: Code that never exits?


    "simonc" <noemail.com> wrote in message
    news:QWLob.1562$Y26.1157872news2.news.adelphia.ne t...
    > 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
    >
    >
    Simon,

    set_error_handler() 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


    Randell D. Guest

  4. #4

    Default Re: Code that never exits?

    "simonc" <noemail.com> wrote in message news:<CVAob.1418$Y26.1032098news2.news.adelphia.n et>...
    > 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?"
    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.
    Daniel Bengs Guest

Similar Threads

  1. Replies: 0
    Last Post: December 20th, 09:35 AM
  2. #38944 [NEW]: ZipArchive exits with SEGV
    By judas dot iscariote at gmail dot com in forum PHP Bugs
    Replies: 3
    Last Post: September 25th, 09:42 AM
  3. function exits/returns - does it free up memory?
    By stephan beal in forum PHP Development
    Replies: 1
    Last Post: August 2nd, 01:47 PM
  4. Replies: 0
    Last Post: July 21st, 03:14 PM
  5. #24066 [Opn]: socket_read() in PHP_NORMAL_READ exits abnormally
    By jason@php.net in forum PHP Development
    Replies: 0
    Last Post: July 21st, 03:11 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139