Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
  I need to run a php script once a day. I'm confused by how to run a
cron tab with php.

   Google is failing me in the search. Is there a clear resource on this?


Re: cron

Quoted text here. Click to load it

I find this hard to believe.  Which keywords were you using?

Quoted text here. Click to load it

Google Suggest supplies these exact keywords:


Quoted text here. Click to load it

If you have any remaining confusion, it probably has to do with cron,
not with PHP.  If this is the case, you should seek help in a UNIX

$email = str_replace('sig.invalid', '', $from);

Re: cron

Jeff wrote:
Quoted text here. Click to load it


A cron job is a unix thingie that is set to run a particular script or
executable -- any script or executable -- at a periodic interval or
intervals.  To use it with php, all you do is run the cli mode of php
passing in the script that you want to run.

When I just did a google putting in the keywords cron php, the very
first item returned was "Running PHP Scripts with Cron | HTMLCenter Web
Development Blog".

Is your post some kind belated "April fool's joke"?


Re: cron

Quoted text here. Click to load it

RTFMers aside, you generally run "crontab -e" from the command line
(on unix/linux) to edit your crontab (the config file for cron).

You add entries using a series of number representing increasing units
of time and the command, e.g.:

  0 7 * * * /usr/bin/php /path/to/script.php >> /var/log/
script_output.log 2>&1

That will run the script every morning at 7:00 am, and redirect its
output to /var/log/script_output.log. If you don't add the 2>&1 to the
end, you will not get your log file.

Site Timeline