The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

cron job to update database error

Discussion in 'Database Discussions' started by iToke, Feb 16, 2012.

  1. iToke

    iToke Active Member

    Joined:
    Sep 23, 2010
    Messages:
    40
    Likes Received:
    0
    Trophy Points:
    6
    Hi,
    I've set up my first cron job to update a database column every night.
    The cron job is stored in a folder above the site root -
    /home/cesco/cron_jobs/update_cat_arrays.php
    the includes folder that update_cat_arrays.php needs to connect to is also stored above the site root -
    /home/cesco/includes/functions.php

    When I tried to run the job via SSH, I get this error -
    Command '"./update_cat_arrays.php"'
    failed with return code 2 and error message
    ./update_cat_arrays.php: line 1: ?php: No such file or directory
    ./update_cat_arrays.php: line 2: syntax error near unexpected token `"../includes/functions.php"'
    ./update_cat_arrays.php: line 2: `include("../includes/functions.php");'.

    the command I'm using in cPanel is - /home/cesco/cron_jobs/update_cat_arrays.php

    thanks for any help.
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,478
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    This doesn't look like a cPanel issue so much as a coding issue of some sort in the update_cat_arrays.php file.
     
  3. iToke

    iToke Active Member

    Joined:
    Sep 23, 2010
    Messages:
    40
    Likes Received:
    0
    Trophy Points:
    6
    That's what I thought.
    It seems to have trouble with this line (line 2) -
    <?php
    include("../includes/functions.php");
    .....

    thanks for the reply
     
  4. iToke

    iToke Active Member

    Joined:
    Sep 23, 2010
    Messages:
    40
    Likes Received:
    0
    Trophy Points:
    6
    fixed the issue by adding 'php -f' to the command line like so - 'php -f /home/cesco/cron_jobs/update_cat_arrays.php'
     
Loading...

Share This Page