FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Cron Jobs dir path





DanielXP
Hi,

I have two scripts i made for my sites that run fine when i run them directly (going to the url)

but when i get cron to run them they dont work.

Here is one of the scripts..

Code:
<?php
include("connection.php");

$game = mysql_fetch_array(mysql_query("SELECT * FROM `games` WHERE `id` > '355' AND `status` = '0' ORDER BY `id` ASC LIMIT 1"));

$imgfilename = $_SERVER["DOCUMENT_ROOT"] . "/games/flash/" . $game[id] . "/img.gif";
$flashfilename = $_SERVER["DOCUMENT_ROOT"] . "/games/flash/" . $game[id] . "/game." . $game[codebase];

if(($game[category_id] != "0") && ((file_exists($imgfilename)) && (file_exists($flashfilename))) && (($game[width] != "0") && ($game[height] != "0"))) {
   $date_added = date("j/n/Y");
   $release_game = mysql_query("UPDATE `games` SET `status` = '1', `date_added` = '" . $date_added . "' WHERE `id` = '" . $game[id] . "'");
}

?>


I think its the file_exist, do you need a different URL when you do it via cron?
TomS
How do you run them?
I assume you're using crontab. They must be called by this command:
Code:
php /path/file.php

If you don't add php in front of the path, it won't work.
DanielXP
Thanks for the reply

Im using,

Code:
php -q /path/file.php


TomS wrote:
How do you run them?
I assume you're using crontab. They must be called by this command:
Code:
php /path/file.php

If you don't add php in front of the path, it won't work.
DanielXP
i really dont understand why this is not working.

The paths are all ok, it works fine when i run it through the URL but not when i get the cron to do it..
Related topics
Cron Jobs
propos des cron jobs
[RESOLVED] cron jobs
Cron jobs
I don't have cron jobs enabled ?
cron jobs
Cron Jobs
Cron Jobs
Cron Jobs
Cron jobs - running a php file
Executing automated tasks without using cron jobs
cron jobs?
Problems With Cron Jobs
how do I auto backup using cron jobs
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.