Jump to content

[SOLVED] script not running when executed with cron


benphelps

Recommended Posts

I have the code below, and it runs just fine, no errors, no warnings.  But when I set it in a cron job, it fails, no idea why.

 

<?
## include, few vars are set and mysql connect stuff here
$result = mysql_query("WORKING MYSQL QUERY");
while($row = mysql_fetch_array($result)){		
if ( ($row['last']+$row['int']) < time()+5 ){
	$send = $row['id'];
	exec("php fork.php \"${send}\" > /dev/null &");
}
}
?>

 

fork.php has no problems, and works fine

I believe I read something about the paths for things on CRON files have to be different because of the way they're ran. So try making them in terms of the root, eg. instead of fork.php try ../whatever/fork.php (or however yours is setup). However, if that fails I also encountered a similar problem with CRON and a php script utilizing MySQL, which I wasn't even including anything on.. and I still couldn't get it to work. It was strange.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.