启动apache报错:error while loading shared libraries: libexpat.so.0


今天从线上拷下来apache的目录,然后启动,提示如下错误:


[root@tradetest bin]# ./apachectl start

/usr/local/apache2/bin/httpd: error while loading shared libraries: libexpat.so.0: cannot open shared object file: No such file or directory


然后到线上服务器上查看库:

[root@info lib]# ldd /usr/local/apache2/bin/httpd

       libaprutil-0.so.0 => /usr/local/apache2/lib/libaprutil-0.so.0 (0x00242000)

       libexpat.so.0 => /usr/lib/libexpat.so.0 (0x00554000)

       libapr-0.so.0 => /usr/local/apache2/lib/libapr-0.so.0 (0x007e2000)

       librt.so.1 => /lib/tls/librt.so.1 (0x00cb6000)

       libm.so.6 => /lib/tls/libm.so.6 (0x00259000)

       libcrypt.so.1 => /lib/libcrypt.so.1 (0x07213000)

       libnsl.so.1 => /lib/libnsl.so.1 (0x07246000)

       libpthread.so.0 => /lib/tls/libpthread.so.0 (0x00442000)

       libdl.so.2 => /lib/libdl.so.2 (0x0027e000)

       libc.so.6 => /lib/tls/libc.so.6 (0x00282000)

       /lib/ld-linux.so.2 (0x0010d000)

于是到线上服务器的/usr/lib下拷贝libexpat.so.0,提示没有这个文件,于是 ll 查看,原来是链接文件,链接到libexpat.so.0.5.0 ,于是拷贝此文件并做链接,再运行ldconfig,再次启动apache,成功。


有些lib*文件不在/usr/lib或/lib下的,可能还需要:

查找lib*文件的位置,并把目录添加到/etc/ld.so.conf.d/libc.conf中,没有则新建这个文件。然后再运行ldconfig才可以。


你可能感兴趣的:(while,object,error,File,open,loading,Directory,or,cannot,shared,shared,No,such,file:,libraries:,libexpat.so.0:)