execute php script with crontab
| From: | rudi | Date: | Mon, 19 Jan 2004 04:01:03 +0000 |
| Subject: | execute php script with crontab | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-174987@lists.php.net to get a copy of this message | ||
Hi There,
I am a new be in php programming ussually i using php under windows, but now i am migrate to linux.
I have php script to write time (testcron.php owner apache chmod 775) into file testcron.txt(owner
apache chmod 775), and i want this script
running from crontab.
My problem is how to execute my script with cron. i know this question it's sound dumbs.. but i
have try it and fail.... may be somebody can
help me..
This is my php script just for checking cron, i am using apache web server in linux redhat 7.3 the
other tutorial say that i have to compile my php script so the cron can execute my script, but how
to compile it and i don't have cgi.
<?
$waktu=date("l-j-F-Y H:i:s");
$jelaskan="Waktu test cron terbaru";
$filename_count = "testcron.txt";
$fcount = fopen ($filename_count, "w") or die("Couldn't open
$filename");
fwrite ($fcount, "$jelaskan ---> $waktu\n");
fclose($fcount);
?>
I have try to added my script in crontab, like this :
[root@city root]# cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# run-parts
#01 * * * * root run-parts /etc/cron.hourly
#02 4 * * * root run-parts /etc/cron.daily
01 * * * * root run-parts /usr/bin/php /var/www/html/cron/testcron.php
#22 4 * * 0 root run-parts /etc/cron.weekly
#42 4 1 * * root run-parts /etc/cron.monthly
There must be something wrong, i don't know what...???, coz this script did not write anything
to a file testcron.txt
Please Tell me WHAT should i do, step by step to setting up this script
with crontab.
Thanks for all help.
idur
---------------------------------
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes