views:

262

answers:

3

Hi,

I am trying to set a cron job using PHP and so far having no luck.

I am following a tutorial PHP - Create a Cron Job with PHP

The file is being created succesfully and all my permissions are correct but the job just dosen't get processed.

Any ideas???

+1  A: 

Maybe your cron daemon isn't running? The daemon "crond" have to run on startup.

Check this with "ps -efc |grep crond"

u2ix
The cron deamon is definately running as I have confirmed this with my host
account holder
A: 

it seems you could have any number of issues here.

Firstly have you checked that the file runs successfully from the command line?

if so another simple solution to the problem could be if you didn't set the file to be added correctly in $command so this could be pointing to a file you don't have.

Also checking that to cron file you have specified matches the directory referenced in these lines:

    // this will reinstate your Cron job

    exec("crontab /Users/vin/Sites/site/cron/Feed_cron"); 
Philderbeast
+1  A: 

Little checklist:

  1. Is your cron running -> u2ix [checked]
  2. Permissions to use cron [checked]
  3. Does your script run in the shell [checked i hope]
  4. Run a litte script that shows you the environmet in your cron (-> env) / it is never the same as in your shell :-)
  5. after execute your php-creat-cronjob-script check with corntab -l the crontab

-- do you get mail from your cron ?

Blauohr