Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to run a PHP script once every 24 hours automatically.

Status
Not open for further replies.

amirkhansemail

Programmer
Jan 22, 2007
11
CA
How can we run a PHP script once every 24 hours automatically on a Linux server.

Thanks
 
man cron
man crontab

"cron" is the scheduler in Linux.
 
i would recommend crontab(5) page "man 5 crontab" as it gives you examples as well as the syntax for the first five fields of a crontab entry
 
Make sure you have the PHP cli installed.

--== Anything can go wrong. It's just a matter of how far wrong it will go till people think its right. ==--
 
Once you have php-cli installed, you'll need to add this as the first line of the php program...
#!/usr/bin/php -q

Similar to perl. Just tell the program where to find the interpreter (php executable). Then use "crontab -e" to edit the crontab. Learn vi commands.

"INSERT" key to start changing usually works.
"ESC" to exit insert mode.
":w" to write the file (that's colon then double-u)
":q" to quit editing crontab.

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top