I want to run PHP scripts automatically. For that I googled and I came to know about CRON. But I dont know how to install and use it. Im using only PHP, CSS, HTML, and running on XAMP apache server on localhost. How to install. Help Me plz
Do you have a Windows machine or a Linux machine?
Under Windows cron is called 'Scheduled Tasks'. It's located in the Control Panel. You can set several scripts to run at specified times in the control panel. Use the wizard to define the scheduled times. Be sure that PHP is callable in your PATH.
Under Linux you can create a crontab for your current user by typing:
crontab -e [username]
If this command fails, it's likely that cron is not installed. If you use a Debian based system (Debian, Ubuntu), try the following commands first:
sudo apt-get update
sudo apt-get install cron
If the command runs properly, a text editor will appear. Now you can add command lines to the crontab file. To run something every five minutes:
*/5 * * * * /home/user/test.pl
The syntax is basically this:
.---------------- minute (0 - 59)
| .------------- hour (0 - 23)
| | .---------- day of month (1 - 31)
| | | .------- month (1 - 12) OR jan,feb,mar,apr ...
| | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
| | | | |
* * * * * command to be executed
Read more about it on the following pages: Wikipedia: crontab
Cron is so named "deamon" (same as service under Win)
Most likely it is already installed on your system (if it is a Linux/Unix system)
Look there
http://www.comptechdoc.org/os/linux/startupman/linux%5Fsucron.html
or there
http://en.wikipedia.org/wiki/Cron
for details