In Linux, we often have to write scheduled tasks, and generally we use crontab. Regarding crontab, you can refer to the following document:
http://www.cnblogs.com/peida/archive/2013/01/08/2850483.html
It needs to be made clear that when executing php files, you must use fully qualified names.
For example:
cd /var/www/html/lws/conf &&/root/php-5.0/bin/php index.php
If you write
php index.php
is a common problem. Both commands and scripts must use fully qualified names.
Not just php, many others also have this problem.
Absolute paths should also be used instead of relative paths in files called internally in php scripts.