The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

CRON JOB Timing Out [500 Internal Server Error]

Discussion in 'General Discussion' started by loki8, Jul 17, 2011.

  1. loki8

    loki8 Registered

    Joined:
    Aug 3, 2010
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Hi all,

    I have created a cron job which runs a single PHP file, send.php

    This file is meant to be running for about 10 hours. (I use sleep(30) between every task within the file and there are MANY tasks, around 1300)

    The thing is I received an email from the Cron Job which mentioned the failure of the Cron AFTER 20-30 minutes of successful running the PHP file.

    This is the last part of the email :

    Code:
    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html><head>
    <title>500 Internal Server Error</title>
    </head><body>
    <h1>Internal Server Error</h1>
    <p>The server encountered an internal error or
    misconfiguration and was unable to complete
    your request.</p>
    <p>Please contact the server administrator,
    webmaster @ dailysurveys4u.com and inform them of the time the error occurred,
    and anything you might have done that may have
    caused the error.</p>
    <p>More information about this error may be available
    in the server error log.</p>
    <p>Additionally, a 404 Not Found
    error was encountered while trying to use an ErrorDocument to handle the request.</p>
    <hr>
    <address>Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at ---</address>
    </body></html>
    I am guessing there is a time limit on running a PHP file from a Cron?

    I am at a VPS with WHM and cPanel available.

    How can I remove that time limit? (if there is one of course)

    thanks
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    What are the limits you have for these values in /usr/local/lib/php.ini file (or a local php.ini if the account is using one of those):

    max_execution_time
    max_input_time
    session.gc_maxlifetime

    Thanks.
     
  3. loki8

    loki8 Registered

    Joined:
    Aug 3, 2010
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    max_execution_time = 99999999
    max_input_time = 60
    session.gc_maxlifetime = 1440

    I changed the max_execution_time yesterday after that happened. Haven't tried to run it again cause I splitted the script to smaller ones tha run for abour 5 minutes each.

    It is strange though that session.gc_maxlifetime is 1440 seconds which equals 24 minutes, really close to the time my script run(about 25 minutes) before getting this error.....
     
  4. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Yes, that is the one I was thinking was the issue and why I included it in the post for evaluation on the time it had available. It's the garbage collection maximum lifetime before clearing collection. I would increase it personally to a higher value.
     
Loading...

Share This Page