PHP and Cron

Discussion in 'Programming/Scripts' started by bradhawk, Dec 5, 2007.

  1. bradhawk

    bradhawk New Member

    Hello all,

    I'm new to running scripts using Cron so I need some help.

    I have a .php file that will run fine when I access it from the browser, but when I try and run it using the code 15 * * * * http://pathname.php.

    I've also tried
    wget -q --delete-after --http-user=user --http-passwd=password http://pathname.php.

    Neither of which seem to work. Can someone lead me in the right direction to get this script to run using Cron? Thanks for any and all input! :)
     
  2. Leszek

    Leszek New Member

    Maybe You should try this:
     
  3. sjau

    sjau Local Meanie

    install the php5-cli package. That will allow you to run a php file from the command line.

    Code:
    10 * * * * php -f /path/to/php/file.php >/dev/null 2>&1
    
    the >/dev/null 2>&1 will make no output or rather put it to /dev/null so that no email with the result is sent to the system user that uses this cron.
     
  4. bradhawk

    bradhawk New Member

    So I contacted the webhost (Lunarpages) and they told me to run this command

    Code:
    10 * * * * php /path/to/php/file.php
    The only problem I see is that the page that I'm trying to run is password protected. How do I deal with this?
     
  5. sjau

    sjau Local Meanie

    make a copy of the .php file that is not password protected.
     

Share This Page