o_helman
asked on
cgi wont run under apache
hi all,
i wrote a cgi that use some so files(shared object).
when i run it from a shell, everything is ok.
when i run it as cgi, it failed and said it can't find the so file.
i added to httpd.conf:
"SetEnv LD_LIBRARY_PATH /mypath/toso"
and it still not working.
do you have any idea ????
appreciate any help
Ori
i wrote a cgi that use some so files(shared object).
when i run it from a shell, everything is ok.
when i run it as cgi, it failed and said it can't find the so file.
i added to httpd.conf:
"SetEnv LD_LIBRARY_PATH /mypath/toso"
and it still not working.
do you have any idea ????
appreciate any help
Ori
Why not just add the directories that contain the needed shared libs to /etc/ld.so.conf and run ldconfig to rebuild the cache. Then restart Apache and your cgi will be able to find the shared libs.
ASKER
hi jlevie
i tried it but it still not working
is there a way to know in what directories the apache is looking when he search for so files?
thanks
i tried it but it still not working
is there a way to know in what directories the apache is looking when he search for so files?
thanks
I'd start with writing a wrapper script for your cgi like this:
#! /usr/bin/sh
echo "Content-Type:text/html"; echo ""
echo '<HTML><BODY><PRE>'
echo "LD_LIBRARY_PATH = $LD_LIBRARY_PATH" '<HR>'
echo "/usr/bin/ldd /path/to/your.cgi"
/usr/bin/ldd /path/to/your.cgi
echo '</PRE></BODY></HTML>'
exit 0
#! /usr/bin/sh
echo "Content-Type:text/html"; echo ""
echo '<HTML><BODY><PRE>'
echo "LD_LIBRARY_PATH = $LD_LIBRARY_PATH" '<HR>'
echo "/usr/bin/ldd /path/to/your.cgi"
/usr/bin/ldd /path/to/your.cgi
echo '</PRE></BODY></HTML>'
exit 0
Apache will use the system shared library search path as shown in /etc/ld.so.conf and any directories in the LD_LIBRARY_PATH env var of the shell that started Apache. You can check to see that the shared libs were found by ldconfig by examining the output of 'ldconfig -p'. Generally all that's necessary is to have the libs in the ld cache, but there are some cases where an application needs certain env variables set that tell it things about it's run time environment. What, exactly, are you trying to do in the cgi?
ASKER
im building a cgi that use some 3rd party libraries to convert files.
i tried building a script and the strange thing happened:
when i run ldconfig -p from shell, he gave me all the necessary files from the right directory.
when i ran it from the script (as cgi) he didnt show the necessary so files. !!!!!!!!!!!!
like he doesn't have them.
how can this be?
i tried building a script and the strange thing happened:
when i run ldconfig -p from shell, he gave me all the necessary files from the right directory.
when i ran it from the script (as cgi) he didnt show the necessary so files. !!!!!!!!!!!!
like he doesn't have them.
how can this be?
ASKER
sorry................:-))
my mistake.........it does show the right libs from the cgi
so whats wrong ??????????????/
my mistake.........it does show the right libs from the cgi
so whats wrong ??????????????/
ASKER
here is the result of my script:
LD_LIBRARY_PATH= /home/ori/wiexp
/usr/bin/ldd /usr/local/apacge/cgi-bin/ convert
libsc_da.so => not found
libsc_ex.so => not found
libsc_fa.so => not found
libsc_ch.so => not found
libsc_fi.so => not found
libsc_ut.so => not found
ldconfig -l
=> /home/ori/wiexp/libvs_zip. so
libvs_xy.so (libc6) => /home/ori/wiexp/libvs_xy.s o
libvs_xl5.so (libc6) => /home/ori/wiexp/libvs_xl5. so
libvs_w97.so (libc6) => /home/ori/wiexp/libvs_w97. so
libvs_w6.so (libc6) => /home/ori/wiexp/libvs_w6.s o
=> /home/ori/wiexp/libsc_da.s o
libsc_da.so(libc6) => /home/ori/wiexp/libsc_da.s o
....
....
...
all the so that im looking for.
so whats wrong ?????????
any idea?
LD_LIBRARY_PATH= /home/ori/wiexp
/usr/bin/ldd /usr/local/apacge/cgi-bin/
libsc_da.so => not found
libsc_ex.so => not found
libsc_fa.so => not found
libsc_ch.so => not found
libsc_fi.so => not found
libsc_ut.so => not found
ldconfig -l
=> /home/ori/wiexp/libvs_zip.
libvs_xy.so (libc6) => /home/ori/wiexp/libvs_xy.s
libvs_xl5.so (libc6) => /home/ori/wiexp/libvs_xl5.
libvs_w97.so (libc6) => /home/ori/wiexp/libvs_w97.
libvs_w6.so (libc6) => /home/ori/wiexp/libvs_w6.s
=> /home/ori/wiexp/libsc_da.s
libsc_da.so(libc6) => /home/ori/wiexp/libsc_da.s
....
....
...
all the so that im looking for.
so whats wrong ?????????
any idea?
ASKER
i solved the problem.
home/ori didnt have access for xwr. !!!!!!!!!!!!
i chmod to 777 and all is working now
thanks guys for your help
home/ori didnt have access for xwr. !!!!!!!!!!!!
i chmod to 777 and all is working now
thanks guys for your help
chmod 555 should be enough
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.