apache with rotatelogs not working : error while loading shared libraries: libaprutil-0.so.0

jayatallen
jayatallen used Ask the Experts™
on
Hi Folks,

i am trying to run apache 2.0(32 bit)  on redhat linux(x86_64 x86_64 x86_64 GNU/Linux
). I installed apache and then ran it using :

$ bash
bash-3.2$ cd /apps/sin/apache/2.0.63/bin
bash-3.2$ ./apachectl -f /apps/sin/apache/2.0.63/conf/httpd.conf -k start
/apps/sin/apache/2.0.63/bin/httpd: error while loading shared libraries: libaprutil-0.so.0: cannot open shared object file: No such file or directory
bash-3.2$ export LD_LIBRARY_PATH=/apps/sin/apache/2.0.63/lib:$LD_LIBRARY_PATH
bash-3.2$ ./apachectl -f /apps/sin/apache/2.0.63/conf/httpd.conf -k start
bash-3.2$

So exporting LD_LIBRARY_PATH worked.

I didnt change any default value in httpd.conf except added rotatelogs with CustomLogs directive as shown below:



#CustomLog logs/access_log common
CustomLog "| /apps/sin/apache/2.0.63/bin/rotatelogs /apps/sin/apache/2.0.63/logs/access_log.%Y-%m-%d-%H_%M_%S 3600" common

Now, apache is running fine but seeing below error for rotatelogs in error_log:
piped log program ' /apps/sin/apache/2.0.63/bin/rotatelogs /apps/sin/apache/2.0.63/logs/access_log.%Y-%m-%d-%H_%M_%S 3600' failed unexpectedly
/apps/sin/apache/2.0.63/bin/rotatelogs: error while loading shared libraries: libaprutil-0.so.0: cannot open shared object file: No such file or directory

Any idea why its happening? Earlier apache was not starting due to same error and export LB_LIBRARY_PATH fixed it.
Please help.

Thank you
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2015

Commented:
use rpm/yum to install official working apache?
Top Expert 2011

Commented:
> error while loading shared libraries: libaprutil-0.so.0
Missing a package called apr-util
If your Linux is RHEL/CentOS/Fedora, do (as root)
yum install apr-util

Author

Commented:
thank you for your reply. This apache is our company build apache and this same package is working in other environments.

As far the error this error is concerned
/apps/sin/apache/2.0.63/bin/rotatelogs: error while loading shared libraries: libaprutil-0.so.0: cannot open shared object file: No such file or directory

libaprutil-0.so.0 is there under /apps/sin/apache/2.0.63/lib.

could it be some other issue?
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

Author

Commented:
also, i was getting the same error when tried to start apache using apachectl. exporting LD_LIBRARY_PATH worked.

bash-3.2$ cd /apps/sin/apache/2.0.63/bin
bash-3.2$ ./apachectl -f /apps/sin/apache/2.0.63/conf/httpd.conf -k start
/apps/sin/apache/2.0.63/bin/httpd: error while loading shared libraries: libaprutil-0.so.0: cannot open shared object file: No such file or directory
bash-3.2$ export LD_LIBRARY_PATH=/apps/sin/apache/2.0.63/lib:$LD_LIBRARY_PATH
bash-3.2$ ./apachectl -f /apps/sin/apache/2.0.63/conf/httpd.conf -k start
bash-3.2$

So exporting LD_LIBRARY_PATH worked.
Top Expert 2015

Commented:
A bit simpler command line
LD_LIBRARY_PATH=/apps/sin/apache/2.0.63/lib:$LD_LIBRARY_PATH ./apachectl -f /apps/sin/apache/2.0.63/conf/httpd.conf -k start
Top Expert 2011
Commented:
Then put
export LD_LIBRARY_PATH=/apps/sin/apache/2.0.63/lib:$LD_LIBRARY_PATH
into the account who start apache. ~/.profile

Author

Commented:
thanks for the command. It helps with apache restart but still getting the same for rotatelogs in error_Log.

/apps/sin/apache/2.0.63/bin/rotatelogs: error while loading shared libraries: libaprutil-0.so.0: cannot open shared object file: No such file or directory
Top Expert 2011

Commented:
Which user run /apps/sin/apache/2.0.63/bin/rotatelogs?
Quick workaround is
ln -s /apps/sin/apache/2.0.63/lib/libaprutil-0.so.0  /usr/lib/libaprutil-0.so.0   (or /usr/lib64/libaprutil-0.so.0)
Then do
ldd /apps/sin/apache/2.0.63/bin/rotatelogs
  to verify any missing library.

Author

Commented:
thanks..i  ran the given the command,ldd o/p shows the required file is missing. I dont have root access to create symbolic link. Could you please suggest another way to get this working?


ldd /apps/sin/apache/2.0.63/bin/rotatelogs
        linux-gate.so.1 =>  (0xffffe000)
        libz.so.1 => /usr/lib/libz.so.1 (0xf7f35000)
        libaprutil-0.so.0 => not found
        libexpat.so.0 => not found
        libapr-0.so.0 => not found
        librt.so.1 => /lib/librt.so.1 (0xf7f2c000)
        libm.so.6 => /lib/libm.so.6 (0xf7f02000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0xf7ed0000)
        libnsl.so.1 => /lib/libnsl.so.1 (0xf7eb7000)
        libpthread.so.0 => /lib/libpthread.so.0 (0xf7e9e000)
        libdl.so.2 => /lib/libdl.so.2 (0xf7e99000)
        libc.so.6 => /lib/libc.so.6 (0xf7d40000)
        /lib/ld-linux.so.2 (0xf7f52000)

ln -s /apps/sin/apache/2.0.63/lib/libaprutil-0.so.0  /usr/lib/libaprutil-0.so.0
ln: creating symbolic link `/usr/lib/libaprutil-0.so.0' to `/apps/sin/apache/2.0.63/lib/libaprutil-0.so.0': Permission denied
bash-3.2$ pwd
Top Expert 2011

Commented:
> ln: creating symbolic link `/usr/lib/libaprutil-0.so.0' to `/apps/sin/apache/2.0.63/lib/libaprutil-0.so.0': Permission denied

Need to run "ln -s" as root.

It seems there are more libraries are required for rotatelogs.
As root, edit /etc/ld.so.conf and add
-------
/apps/sin/apache/2.0.63/lib/
-------
After that, run
ldconfig

Then verify again
ldd /apps/sin/apache/2.0.63/bin/rotatelogs

Author

Commented:
thank you for help. I dont access to this box as root. I tried cronolog and its working fine.

Thank you for your prompt reply.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial