how to run a php script daily with the cron job on Ubuntu os

前端 未结 4 898
情话喂你
情话喂你 2021-01-14 08:50

command to runI am using ubuntu 12 and lamp server . I want to run a php script after every 1 hour . i have create a crontab to execute this and if i check my cron list with

4条回答
  •  死守一世寂寞
    2021-01-14 09:46

    To find out what is wrong with your cron you can type the following command in your terminal:

    grep -i "cron1.php" /var/log/syslog
    

    The syslog contains all log of crons.

    Try run the code /usr/bin/php5 -q /var/www/cronjobs/cron1.php on terminal to check if there are errors.

    You can also redirect all errors to a file:

    0 * * * * /usr/bin/php5 -q /var/www/cronjobs/cron1.php 2> /tmp/errorCron1.txt
    

提交回复
热议问题