php cron job<

liunx

Guest
Okay, I'm sure I'm missing something obvious...but I'm missing it nonetheless.

I have a php script that I am wanting to run as a cron job. The script, feature_update.php, has a require_once statement to include a script, db_mysql.php, so that feature_update.php can update a database. feature_update.php and db_mysql.php are in the same directory (not in public_html). I'm getting the following error though:

/home/username/autoscripts/feature_update.php: ?php: No such file or directory
/home/username/autoscripts/feature_update.php: line 3: syntax error near unexpected token `require_once("db_mysql.php")'
/home/username/autoscripts/feature_update.php: line 3: ` require_once("db_mysql.php");'


This is the code I have in the first few lines of feature_update.php:

<?php

require_once("db_mysql.php");
$db = new db_mysql();

$q = "SELECT product_id FROM product WHERE product_feature = 'Y'";

I also have an htaccess file in the same directory that has feature_update.php and db_mysql.php. In it I have the following line:

php_value include_path .:/home/username/autoscripts/

Finally, I have the following command for the cron job:

0 0 * * * /home/username/autoscripts/feature_update.php

Can anyone tell me what I'm doing wrong. If you need more info from me let me know.

Thanks.looks to me that you can't run php before the web root. not sure but even if you include it in the .htaccess file like you are that it isn't getting there. move it to another folder just to see if it works without flaw, then worry about running it from another folder above the root.well, as I said, it was something obvious that I was missing. I had forgotten to put the "php" command in the line. I think I'll go bang my head against the wall for a bit.

thanks for the help.where?guess you don't want to tell anybody :)
 
Back
Top