Search code examples
phpzend-frameworkcron

implement a cron in a zend frame work project


HI I want to implement a cron job in my Zendframe work. I have checked its phpinfo then I got Server API is CGI/FastCGI and SERVER_SOFTWARE is Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8m DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635

So i realized that my project is running at CGI

I am new to this Cron job. also i don't know shell and related words. So please give me any good tutorial to implement crone job

Thanks in advance


Solution

  • Check out this tutorials on crons

    http://clickmojo.com/code/cron-tutorial.html

    http://www.htmlcenter.com/blog/running-php-scripts-with-cron/

    What you need first is to implement the logic of the task in your script and then just run the script with crontab. Use

    crontab -e 
    

    to edit your crontab file.

    Talking about zend, you can

    1)put the required code in one of you controllers

    or

    2) -create a folder "crons" in you project

    -put a new php script in this folder

    -put a cron job in your crontab file to run your script

    your crontab file may look like this

    30 18 * * * php /path-to-your-cron/cron.php