On Sun, 2004-01-18 at 23:01, rudi wrote: > 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 : > > [EMAIL PROTECTED] 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
Double check your file path. You may want to use an absolute path. You might also try firing an error or an email to yourself at the beginning of your script to see if the script is actually running. Check your cron logs also. Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php