Results 1 to 5 of 5

Thread: php cron jobs

  1. #1
    Join Date
    Feb 2009
    Posts
    37

    Default php cron jobs

    how to i implement the php cron job concept...

    Thanks,
    Thirumalai.S

  2. #2
    Join Date
    Jun 2008
    Posts
    232

    Default

    What do you mean by "the php cron job concept"?

    Could you provide a link to what you are referring to?

  3. #3
    Join Date
    Jul 2007
    Location
    127.0.0.1
    Posts
    392

    Default

    Quote Originally Posted by thirumalai View Post
    how to i implement the php cron job concept...
    Just like any other cron job.

    Code:
    [6][nydc ~]:# crontab -l
    # m h  dom mon dow   command
    35 4 * * 2 php-cgi /root/cronjobs/new-posts.php >/dev/null 2>&1
    [7][nydc ~]:#
    That would run "new-posts.php" every Tuesday at 04:35 am.

  4. #4
    Join Date
    Dec 2007
    Posts
    1,141

    Default

    Alternatively you could add the PHP shebang to your PHP script (if you plan to run the script exclusively via cronjob):

    PHP Code:
    #!/usr/bin/php
    <?php

    // Your script

    ?>
    Determine the correct shebang contents by running which php (you may need to install the which application if it is not already installed on your VPS).

    Note that your script will also need the correct execute permissions to allow cron to run it.

  5. #5
    Join Date
    May 2009
    Location
    Kochi, India
    Posts
    8

    Default

    you should also try to install the PHP CLI before running php cron jobs, it makes it much easier

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •