Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: unable to run php cron jobs

  1. #1
    amitgad is offline x10Hosting Member amitgad is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    26

    unable to run php cron jobs

    Hi,

    I have been facing this issue since more than a month now. The issue is i have scheduled a php cron job that used to run perfectly earlier, but now it doesnt run.

    To test the functionality, i have set up a test cron job @
    http://amit.exofire.net/test2/appl/php.php

    that runs every hour and sends out a test mail.

    The command i'hv used is-
    /usr/local/bin/php /home/amitgad/public_html/test2/appl/php.php

    further when i run the php file directly from internet explorer it works and sends out the mail. but when i schedule it using cron jobs, it doesnt even run.

    Please guide me on this if I'm missing here something or if you have changed any settings.


    Thanks
    Amit

  2. #2
    amitgad is offline x10Hosting Member amitgad is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    26

    Re: unable to run php cron jobs

    hello!
    anyone has any answer for this...
    will help me a lot....
    thanks

  3. #3
    Anna's Avatar
    Anna is offline I am just me Anna is a name known to allAnna is a name known to all
    Join Date
    Aug 2007
    Location
    Sweden
    Posts
    6,569

    Re: unable to run php cron jobs

    try changing to: /usr/bin/php /home/amitgad/public_html/test2/appl/php.php

    Note the changed path for php.
    Do you have trouble reaching your site?
    Check here first: News and Announcements


    Don't forget that x10hosting has an irc server as well. Come and join the fun
    server: irc.x10hosting.com, main channel: #x10hosting
    There's a lot helpful users there if need help building your site

  4. #4
    amitgad is offline x10Hosting Member amitgad is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    26

    Re: unable to run php cron jobs

    Hey Anna...
    thanks for the help..but I'm afraid it doesn't work either!
    i guess there was some change made to the cron jobs..probably in dec-jan...because it was working earlier!!

  5. #5
    Anna's Avatar
    Anna is offline I am just me Anna is a name known to allAnna is a name known to all
    Join Date
    Aug 2007
    Location
    Sweden
    Posts
    6,569

    Re: unable to run php cron jobs

    Only thing that might be changed is that php mail() needs to have the content type text/plain
    Last edited by Anna; 03-13-2011 at 05:15 AM.
    Do you have trouble reaching your site?
    Check here first: News and Announcements


    Don't forget that x10hosting has an irc server as well. Come and join the fun
    server: irc.x10hosting.com, main channel: #x10hosting
    There's a lot helpful users there if need help building your site

  6. #6
    amitgad is offline x10Hosting Member amitgad is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    26

    Re: unable to run php cron jobs

    thanks,
    but if i click the above link, it sends out the mail and if i schedule it for cron jobs, it doesnt run. So I'm not sure if mail function is giving problems. Nevertheless, i have given the php code for the above script below-

    PHP Code:
    <?php

    $ip
    =$_SERVER['REMOTE_ADDR'];
    $from "JobScheduler";
    $to "xxx@abc.com";
    $subject "hello test msg";
    $message "Hello test" "\n your ip address is: $ip";
    $headers 'From: ' $from "\r\n" 'Reply-To: ' $from "\r\n" .
        
    'X-Mailer: PHP/' phpversion();

    // Send
    if (mail($to$subject$message$headers)) {
        echo 
    "-->mail sent";

    echo 
    "<b>IP Address= $ip</b>";

    } else {
        echo 
    "failed";
    }
    ?>

  7. #7
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,635

    Re: unable to run php cron jobs

    PHP mail() does not work properly when run as a cron job, period.
    Nothing is always absolutely so.

  8. #8
    amitgad is offline x10Hosting Member amitgad is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    26

    Re: unable to run php cron jobs

    okay....but is there anyway around to make this work, because i need this for my app to work. I would be very thankful.

  9. #9
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,635

    Re: unable to run php cron jobs

    1. Get Google Apps account for your domain
    2. Follow their instructions to use cPanel to set MX records to Google. All incoming mail will be routed to Google Apps account
    3. Download and use PHPMailer to send your outgoing mail via STMP thru your Google Apps account.
    Nothing is always absolutely so.

  10. #10
    amitgad is offline x10Hosting Member amitgad is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    26

    Re: unable to run php cron jobs

    hey thanks..will check out.

Closed Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Cron Jobs unable to run
    By amitgad in forum Free Hosting
    Replies: 5
    Last Post: 09-22-2010, 10:23 PM
  2. Cron Jobs
    By a3whizzkid84 in forum Free Hosting
    Replies: 1
    Last Post: 08-30-2010, 04:53 PM
  3. Cron Jobs
    By ehiagwina in forum Free Hosting
    Replies: 21
    Last Post: 07-15-2008, 07:30 AM
  4. cron jobs help
    By Killa619 in forum Free Hosting
    Replies: 4
    Last Post: 11-13-2007, 05:02 AM
  5. Cron Jobs
    By ehiagwina in forum Scripts & 3rd Party Apps
    Replies: 6
    Last Post: 09-09-2007, 02:22 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers