Link to home
Start Free TrialLog in
Avatar of dmiebim
dmiebimFlag for Türkiye

asked on

php5 code on crontab failed

Hi All,
I have a php5 script that runs well by manually. It connects a sybase db, makes same calculations and insert them in a sybase table. But, when I try to work it in crontab, I always getting this error;

"/usr/bin/php: error while loading shared libraries: libsybunic.so: cannot open shared object file: No such file or directory"

I've tried to put environment variables in the beginning of php code but didn't work.
Any idea?


Beginning of code is like this;

#!/usr/bin/php5 --
<?
        putenv ("SYBASE=/home/sybase");
        putenv ("SYBASE_OCS=OCS-15_0");
        putenv ("SYBASE_ASE=ASE-15_0");
        putenv ("SYBASE_SYSAM=SYSAM-2_0");
        putenv ("PATH=$SYBASE/bin:$SYBASE/$SYBASE_ASE/bin:$SYBASE/$SYBASE_OCS/bin:$SYBASE/$SYBASE_SYSAM/bin:$PATH");
        putenv ("LD_LIBRARY_PATH=$SYBASE/lib:$SYBASE/$SYBASE_ASE/lib:$SYBASE/$SYBASE_OCS/lib:$LD_LIBRARY_PATH");
     

        global $conn;
         $conn = sybase_connect('EBIMFS', 'radiousr', 'xxx');
........




Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

$SYBASE is undefined in the code snippet.  It looks like the script might depend on register_globals. See this page:
http://www.php.net/manual/en/security.globals.php
Avatar of tel2
Hi dmiebim,
Looks to me as if the environment of your cron job is different from your own account (which is to be expected), and it seems that you might have already started looking down this path.
What is the full path to libsybunic.so?  One way to find it is by typing this at the UNIX/Linux command prompt:
    which libsybunic.so
or:
    locate libsybunic.so
Then make sure libsybunic.so's directory is in the:
    putenv ("PATH=...
line.

Or you could just login to your account, and type:
    echo $PATH
and make sure all the possibly relevant directories displayed are included in that
    putenv ("PATH=...
line.
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dmiebim

ASKER

problem resolved