Cron Jobs & PHP

danielneridanielneri WP V.I.P.VPS - Virtual Prince of the Server
Im trying to execute a php script from a cron job.

The command im using is "php -q /path/to/backup.php". but everytime the script is run, i get an error saying "No input file specified".

What am I doing wrong?
ban1.gif

Comments

  • NuvoNuvo Forum Leader VPS - Virtual Prince of the Server
    If your host is using mod_php and doesn't support PHP via CGI, CRON won't be able to run the job as the module can't be executed via the command line.
    Also, is that the whole of the command you're using?
    CRON jobs usually follow this format:
    [minute] [hour] [day of month] [month] [day of week] [command to run]
    
    But I can't claim to be an expert on CRON as I pretty much never use it.
    PHP, CSS, XHTML, Delphi, Ruby on Rails & more.
    Current project: CMS Object.
    Most recent change: Theme support is up and running... So long as I use my theme resource loaders instead of that in the Rails plug-in.
    Release date: NEVER!!!
  • danielneridanielneri WP V.I.P. VPS - Virtual Prince of the Server
    I'm running the cron through c-panel the 'simple' way. So the only invalid command would come from this statement "php -q file.php".

    From what i've read thats not exactly an invalid command.

    I guess I'll send a ticket to bluehost and see if they can help.

    Thanks!
    ban1.gif
  • WatchOutWatchOut Advanced User VPS - Virtual Prince of the Server
    Did you solve it, mate? That's nothing i can help you with directly, but i can try to get help..
    Computer Forumz

    www.computerforumz.com
  • NuvoNuvo Forum Leader VPS - Virtual Prince of the Server
    danielneri wrote: »
    I'm running the cron through c-panel the 'simple' way. So the only invalid command would come from this statement "php -q file.php".

    From what i've read thats not exactly an invalid command.

    I guess I'll send a ticket to bluehost and see if they can help.

    Thanks!
    Like I said, if they are using the Apache module, mod_php over CGI, it might not be possible to do that command with straight up CRON as the module version of PHP isn't available from the command line \ terminal \ console \ whatever you want to call it.
    There's scripts out there that tackle this issue in other ways though, so if CRON won't work for you, it might still be possible.
    PHP, CSS, XHTML, Delphi, Ruby on Rails & more.
    Current project: CMS Object.
    Most recent change: Theme support is up and running... So long as I use my theme resource loaders instead of that in the Rails plug-in.
    Release date: NEVER!!!
  • danielneridanielneri WP V.I.P. VPS - Virtual Prince of the Server
    Ok I solved it :D

    My host requires me to specify the path of php instead of using php -q i have to use:
    "/usr/bin/php -q /home/USERNAME/public_html/PathToFile{@}
    ban1.gif
Sign In or Register to comment.