I want to use cron jobs to run my php file every week. URL of my file is - Sanganak.co.in/sunil/showdata2.php What should I write for - Command to run _____ Please solve my query. thanks
You would use a cron something like this to run a php file one time a week: 5 4 * * sun php /home/servername/public_html/sunil/showdata2.php Don't forget the space between php and this / Be sure your "showdata2.php" file has the necessary permissions to be executable i.e.,("chmod 755"). 5 4 * * sun This setting will run at 5 minutes after 4 every sunday. So you will need to edit to the day you want and the time. If the above does not work try it like this: 5 4 * * sun /usr/local/bin/php -q /home/servername/public_html/sunil/showdata2.php > /dev/null 2>&1 Make sure to change servername to your server path name. Boulder
Best to use cpanel to set this up. http://phpprogrammerofbangladesh.wordpress.com/2007/08/01/how-to-setup-cron-job-using-cpanel/
you can use "curl" or "wget" to run your crons by doing this .... * * * * * curl -O /dev/null http://yourcronurl.com/cron.php which will run every minute. every week would be this.... 0 0 */7 * * curl -O /dev/null http://yourcronurl.com/cron.php if that doesnt work... replace curl with wget... 0 0 */7 * * wget -O /dev/null http://yourcronurl.com/cron.php
using cpanel cron option for standard user Put this in command box -> php -q /real path / to cron /file/cron.php choose the timing from list boxes as per your requirement Regards Alex
If you have a dedicated box there won't be cpanel, unless you install it. Its not necessary, that sort of stuff just clogs up your server.
If you have compiled Php as cgi you can do php-cgi /source/to/script.php php-cli /source/to/script.php yeah and cpanel sucks if you can do everything with shell.