Will a CRON JOB follow a PHP HEADER change?

Discussion in 'PHP' started by moronic_kaos, Mar 12, 2010.

  1. #1
    I have a script that has to communicate with multiple websites via cURL, and the time it takes to execute this is rather long. It is so long, in fact, that the server sometimes TIMES OUT the process before it is completed. The solution I thought of was to change the HEADER and go to a new .php file to communicate with each different website. Therefore, it would look like multiple small processes to the server rather than one large one. But I have a problem:

    This process needs to be called via a CRON JOB at certain time intervals. Will a CRON JOB continue with wherever the HEADER points to, or does it simply stop the process?

    • Note: I tried changing the SET_TIME_LIMIT option via PHP on the server, but they have that feature locked at 10 seconds.
    • Note: I can set the TIMEOUTs for my CRON JOBs to whatever, so I'm not really concerned about the overall length of the entire process (around 10-15 seconds).
     
    moronic_kaos, Mar 12, 2010 IP
  2. superdav42

    superdav42 Active Member

    Messages:
    125
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #2
    It depends on how you start your cron jobs. You can just use the path to the php file which I doubt would function correctly with changing the header or you can use a command like wget example.com/script.php to run the job which would probably follow the new headers correctly.

    Note: I have had luck extending the time limit using ini_set(), have you tried that?
     
    superdav42, Mar 12, 2010 IP
  3. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #3
    Why don't you use the curl command line version instead of the curl in php?
     
    Kaizoku, Mar 14, 2010 IP