centos cron job running php file

Posted by user50946 on Server Fault See other posts from Server Fault or by user50946
Published on 2011-02-01T14:45:24Z Indexed on 2011/02/01 15:27 UTC
Read the original article Hit count: 243

Filed under:
|
|
|

I have a php file under php called test.php set to run every 5th minute of the hour. When ever I run the file manually (by going to the web browser and runnint the path) it works fine. But when the cron job tries to run it I get the error message

my cron job is

#### Delete Records
5 * * * * /var/www/html/phpsysinfo/cronUpdateLeadBucketOnEnergycAlliance.php

my phpfile is (path : /var/www/html/phpsysinfo/phpfile)

<?php 
require("dbconnect.php");
 $sql = mysql_query("DELETE FROM list where status <> 'LEAD'") or die(mysql_error());
?>

and the error that I get is:

/var/www/html/phpsysinfo/phpFile.php: line 1: ?php: No such file or directory
/var/www/html/phpsysinfo/phpFile.php: line 2: syntax error near unexpected token `"dbconnect.php"'
/var/www/html/phpsysinfo/phpFile.php: line 2: `require("dbconnect.php");

thanks

© Server Fault or respective owner

Related posts about cron

Related posts about php5