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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.