Solved

cgi wont run under apache

Posted on 2002-07-18
10
358 Views
Last Modified: 2013-11-18
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
0
Comment
Question by:o_helman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
  • +1
10 Comments
 
LVL 40

Expert Comment

by:jlevie
ID: 7162093
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.
0
 

Author Comment

by:o_helman
ID: 7162125
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
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7162206
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
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 40

Expert Comment

by:jlevie
ID: 7162231
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?
0
 

Author Comment

by:o_helman
ID: 7162322
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?
0
 

Author Comment

by:o_helman
ID: 7162331
sorry................:-))
my mistake.........it does show the right libs from the cgi

so whats wrong ??????????????/

0
 

Author Comment

by:o_helman
ID: 7162395
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.so
        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.so
=> /home/ori/wiexp/libsc_da.so
        libsc_da.so(libc6) => /home/ori/wiexp/libsc_da.so
....
....
...
all the so that im looking for.
so whats wrong ?????????
any idea?

0
 

Author Comment

by:o_helman
ID: 7162443
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  
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7163344
chmod 555 should be enough
0
 

Accepted Solution

by:
ComTech earned 0 total points
ID: 7167881
This question will be placed in PAQ, and points refunded.

Regards,

ComTech
Community Support Administrator  
Experts-Exchange  
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
LogmeIn using Linux Ubuntu 16.04 6 170
Why would ubuntu server 16.04 compress so many small access.log.gz files? 4 54
Linux 3 57
DB2 9.7 Grant Execute SP 4 58
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
The viewer will learn how to count occurrences of each item in an array.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question