dmiebim
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_A SE/bin:$SY BASE/$SYBA SE_OCS/bin :$SYBASE/$ SYBASE_SYS AM/bin:$PA TH");
putenv ("LD_LIBRARY_PATH=$SYBASE/ lib:$SYBAS E/$SYBASE_ ASE/lib:$S YBASE/$SYB ASE_OCS/li b:$LD_LIBR ARY_PATH") ;
global $conn;
$conn = sybase_connect('EBIMFS', 'radiousr', 'xxx');
........
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
putenv ("LD_LIBRARY_PATH=$SYBASE/
global $conn;
$conn = sybase_connect('EBIMFS', 'radiousr', 'xxx');
........
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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
problem resolved
http://www.php.net/manual/en/security.globals.php