PDA

View Full Version : How to make a cron..?



Corey
01-23-2007, 01:33 PM
So, I've been trying to get my cron to run a php script, but it will not work. I google'd it and tried all different methods; but nothing seemed to work.

I added this to the top of my php script;

#!/usr/local/bin/php

Here is what my admin panel looks like for setting up a cron;
http://img247.imageshack.us/img247/8080/mysqlcron3cf.png
As you can see.. I tried different methods there, as well.

Thanks for any help.

nobaloney
01-23-2007, 05:43 PM
Keep these points in mind:

The cron job will be run as the user and using the user's environment. So you'll need complete paths for everything in the script.

You'll need to make sure you have command-line php installed, as cron jobs do NOT use the php functionality built into apache.

To test:

First temporarily turn on ssh for the user.

Then log into the shell as the user (you can use su - if you want, but do not use su without the - character.

Then run the cronjob exactly as typed into the cronjob.

See what errors, if any, you get.

jeff

Corey
01-24-2007, 03:58 PM
Erm; I may have posted this in the wrong place then.. but I am not a provider. I bought my hosting and only have access to direct admin. I am not the actual host.

nobaloney
01-25-2007, 07:45 PM
Then you should probably ask your provider; they can most likely help you.

Jeff