Saturday, October 11, 2014

Using Cron Job to process PHP scripts

Using Cron Job to process PHP scripts.
For example, we have test.php and want to run it  every day using cron job.
1) test.php
    echo '<h1> This is  a test for cron job</h1>';

 2) Create a shell script
#! /bin/sh
#wget -q --no-check-certificate -O- ""
php test.php
3) run following in shell to make executable
chmod +x
4)  The reason we want to use php instead of wget is that we do want outside people access test.php
Set up .htaccess to Deny from all in the directory of
<Files "*">
    Order deny, allow
    Deny from all

5) crontab -e
30 23 * * * /home/jiansenl/crontest/
each night 23:30pm to  run
6) crontab -l
list cron jobs.
Video: Using Cron Job to process PHP scripts

1 comment:

  1. hello. thanks for the article.
    i have tried this on a suse leap 42 without sucess.

    php gives me error
    im trying to read a php page wich reads a series of parameters and stores them to a mysql db.