Re: php script fails when run from cron

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It's remotely possible that your database classes are trying to create
temp files or cache files or something in the "current working
directory" which for cron would be...  The home directory of the user
running it???

I don't even know what it would be, but I know it can be problematic.

The cron job IS running as the same user as when you do it on
command-line right???

I mean, maybe freetds refuses to connect as 'root' user, and you put
the cron in as 'root'?

It's going to boil down to user/path/permissions, almost for sure.

On Wed, May 3, 2006 9:27 pm, blackwater dev wrote:
> I have a script which runs fine from the command line but when I try
> to run
> it via cron, it seems to fail when the db class is instatiated, here
> is some
> code:
>
> $yesterday  = date("Y-m-d",mktime(0, 0, 0, date("m")  , date("d")-1,
> date("Y")));
>  $file=fopen("/usr/local/apache2/htdocs/core/logs/import.log","a");
>  fwrite($file,"---------DATE:".date("Y-m-d")."---------\n");
>  fwrite($file,"Starting:".date("H:i:s")."\n");
>  include("/usr/local/apache2/htdocs/includes/lib/ms_db.class.php");
>  include("/usr/local/apache2/htdocs/includes/lib/database.php");
>  fwrite($file,"got two classes:".date("H:i:s")."\n");
>   $ms_sql= new ms_db();
>   $my_sql=new Database();
>
>  fwrite($file,"got 1:".date("H:i:s")."\n");
>
>
> The code then goes on to move some data from a remote SQL Server db to
> the
> local mysql.  When finished, the log stops at "got two classes".  I am
> trying to debug now to see which of the two classes it seems to be
> failing
> on.  I don't have anything in the php error log.  The MSSQL connection
> uses
> freetds so I am not sure if it is something there but again this
> script runs
> fine with just php myfile.php.
>
> Any ideas?
>
> Thanks!
>


-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux