Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Oct 2002
    Location
    California
    Posts
    98
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to run PHP script from CronJob??

    I've never used CronJob before, what would the 'command' look like if I wanted to run a particular PHP script once per month???

    Also, what do the asteriks mean for times?

    Thanks

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,073
    Thanks
    11
    Thanked 98 Times in 96 Posts
    the asterisks are just unused 'fields' ?? for want of a better explanation normally representing 'any' in the same way as a wildcard ...representing ....

    mins hour day_of_month month_of_year day_of_week

    so

    0 * 1 * * /home/user/script.php

    would run the script when the clock was equal to 0 minutes on the first day of the month , the asterisks saying 'any month of the year' 'any day of the week (assuming it is the first of the month!)' etc.

    note that you will need to have php available as a CGI and have the shebang line at the head of the script...

    #!/usr/bin/php

    OR schedule say lynx/whatever to call a php page
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #3
    New Coder
    Join Date
    Oct 2002
    Location
    California
    Posts
    98
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hey thanks for the help

    I'm confused about the 'shebang' line, does that go at the top of my PHP script? Or in the command line?

    Also, should it point to the CGI directory, even though the script is in the /public/ directory? Or should it actually reside in the CGI bin directory?

    Argh, thanks for trying


  •  

    Posting Permissions

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