Closed Thread
Results 1 to 5 of 5
Like Tree4Likes
  • 3 Post By xnagarohit62
  • 1 Post By descalzo

Thread: Unable to run Cron Jobs - PHP

  1. #1
    xnagarohit62 is offline x10Hosting Member xnagarohit62 is an unknown quantity at this point
    Join Date
    Feb 2011
    Posts
    7

    Exclamation Unable to run Cron Jobs - PHP

    Hi all, Kindly help me in setting up a cron job..
    initially i tried with setting up a simple script that just sends out a mail every time it is run.. I waited patiently for any reply from my inbox but it was in vain..
    I used these commands:
    /usr/local/bin/php /home/xsnr/public_html/test/cron.php
    and php /home/xsnr/public_html/test/cron.php

    Neither of which worked. Then i tried setting up a script with just an "echo" statement, set up the mail id from the cpanel and then again waited patiently again in vain..

    I tried with settings or running every minute (for testing purpose) and run every 10 minutes again in vain.. Is cron working ??

  2. #2
    Skizzerz's Avatar
    Skizzerz is offline Contributors Skizzerz will become famous soon enough
    Join Date
    Nov 2007
    Location
    Texas
    Posts
    2,153

    Re: Unable to run Cron Jobs - PHP

    We have restrictions on cron jobs on Free Hosting in that you may only have one cron running every 5 minutes. This means that a minute cron is straight disallowed, and if you have more than 1 cron job, you need to time them so that they are at least 5 minutes apart.

    Check your mail settings as well in that script, to make sure you aren't trying to forge any email headers, as that is also blocked by our server. The email account you are putting in the From: field should be an email account that exists on your cPanel

    Finally, use the following as a command (this logs output to a cron.log file in your home directory):
    php /home/xsnr/public_html/test/cron.php >> /home/xsnr/cron.log 2>&1

  3. #3
    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 Cron Jobs - PHP

    Code:
    /usr/local/bin/php /home/xsnr/public_html/test/cron.php  >>/home/xsnr/public_html/test/cron_log.txt 2>&1
    For testing, use every 5 minutes. The system is set up to delete 1 minute jobs. This puts any output (echo) or error messages into cron_log.txt . The mail notification system has been turned off.
    Nothing is always absolutely so.

  4. #4
    xnagarohit62 is offline x10Hosting Member xnagarohit62 is an unknown quantity at this point
    Join Date
    Feb 2011
    Posts
    7

    Re: Unable to run Cron Jobs - PHP

    @Skizzerz and @descalzo: Thanks for your replies.. heres what i got a trace on the log file generated by the above cron as indicated by the command " /usr/local/bin/php /home/xsnr/public_html/test/cron.php >>/home/xsnr/public_html/test/cron_log.txt 2>&1 "

    Can't do setuid (cannot exec sperl)

    Please help..

  5. #5
    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 Cron Jobs - PHP

    You are trying to use mail() in the script. For some reason it throws that error for everybody.

    Alternative is to run the script from the Web via wget.

    Code:
    wget -O -  http://yourURL/test/cron.php?key=67ni8eadn9969 >>/home/xnrs/public_html/test/cron_log.txt 2>&1
    Add a bit of code at the top of your script to test 'key' (change to your own random string) so it won't get called by accident.

    And the -O is "capital oh", not "zero"
    Last edited by descalzo; 06-20-2011 at 03:03 PM.
    xnagarohit62 likes this.
    Nothing is always absolutely so.

Closed Thread

Similar Threads

  1. unable to run php cron jobs
    By amitgad in forum Free Hosting
    Replies: 10
    Last Post: 04-15-2011, 07:46 AM
  2. Cron Jobs
    By inadim8956 in forum Free Hosting
    Replies: 4
    Last Post: 01-14-2011, 08:30 AM
  3. Cron Jobs unable to run
    By amitgad in forum Free Hosting
    Replies: 5
    Last Post: 09-22-2010, 10:23 PM
  4. Cron jobs
    By sambhavsoft in forum Free Hosting
    Replies: 1
    Last Post: 08-21-2009, 02:02 PM
  5. Cron Jobs
    By ehiagwina in forum Free Hosting
    Replies: 21
    Last Post: 07-15-2008, 07:30 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