Re: php script fails when run from cron

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

 



blackwater dev wrote:
Chris,

The double php thing is very likely as it is a box from my host and I installed php5 so I think php4 is on there somewhere as well without mssql support.

I am simply running it like
15 21 * * * php /usr/local/apache2/htdocs/import.php

How can I tell it which one to use? I just have php5 loaded as a .so module in apache.

Always CC the list :)

Use the full path:

/path/to/right/php /usr/local/....

if you do:

whereis php

it will show all versions (and directories like /usr/lib/php for example) which are in your path.

php -v

will help tell you which one is the right one.. if not:

php -i

and go through the output.

On 5/3/06, *Chris* < dmagick@xxxxxxxxx <mailto:dmagick@xxxxxxxxx>> wrote:

    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.

    Do you have multiple php versions installed (one has freetds support,
    one doesn't) ?

    How are you running it from cron?

    Maybe the cron job is picking up a different php?

    Turn up error_reporting and see what messages you get..

    --
    Postgresql & php tutorials
    http://www.designmagick.com/




--
Postgresql & php tutorials
http://www.designmagick.com/

--
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