...

View Full Version : How to run PHP script from CronJob??



nickbarresi
02-05-2003, 10:29 AM
I've never used CronJob before, what would the 'command' look like if I wanted to run a particular PHP script once per month???

Also, what do the asteriks mean for times?

Thanks:)

firepages
02-05-2003, 03:34 PM
the asterisks are just unused 'fields' ?? for want of a better explanation :) normally representing 'any' in the same way as a wildcard ...representing ....

mins hour day_of_month month_of_year day_of_week

so

0 * 1 * * /home/user/script.php

would run the script when the clock was equal to 0 minutes on the first day of the month , the asterisks saying 'any month of the year' 'any day of the week (assuming it is the first of the month!)' etc.

note that you will need to have php available as a CGI and have the shebang line at the head of the script...

#!/usr/bin/php

OR schedule say lynx/whatever to call a php page

nickbarresi
02-09-2003, 06:33 AM
Hey thanks for the help:)

I'm confused about the 'shebang' line, does that go at the top of my PHP script? Or in the command line?

Also, should it point to the CGI directory, even though the script is in the /public/ directory? Or should it actually reside in the CGI bin directory?

Argh, thanks for trying:D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum