当前位置首页 > Apache知识

apache2启动时共享库libpcre找不到

阅读次数:292 次  来源:admin  发布时间:

安装好Apache,启动时提示找不到libpcre.so.1:

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

使用ldd查看httpd的依赖库信息:

# ldd httpd
linux-vdso.so.1 => (0x00007fff691ff000)
libpcre.so.1 => not found
libaprutil-1.so.0 => /usr/local/apache2/lib/libaprutil-1.so.0 (0x00007ff847f31000)
libapr-1.so.0 => /usr/local/apache2/lib/libapr-1.so.0 (0x00007ff847d00000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff847ae3000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff847726000)
libexpat.so.0 => /usr/local/apache2/lib/libexpat.so.0 (0x00007ff8474fb000)
libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007ff8472c2000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ff8470be000)
/lib64/ld-linux-x86-64.so.2 (0x00007ff848165000)

libpcre.so.1库果然没有找到。

解决方法:

1. 搜索libpcre.so.1文件,发现该文件在/usr/local/lib目录下。

2. 在/etc/ld.so.conf.d目录下新建文件libc.conf,将/usr/local/lib目录加到该文件:

/usr/local/lib

3. 执行ldconfig命令:

sudo ldconfig

4. 使用ldd命令确认libpcre.so.1是否已找到:

# ldd httpd
linux-vdso.so.1 =>  (0x00007fffcc3ff000)
libpcre.so.1 => /usr/local/lib/libpcre.so.1 (0x00007f2f68f98000)
libaprutil-1.so.0 => /usr/local/apache2/lib/libaprutil-1.so.0 (0x00007f2f68d76000)
libapr-1.so.0 => /usr/local/apache2/lib/libapr-1.so.0 (0x00007f2f68b45000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f2f68928000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2f6856b000)
libexpat.so.0 => /usr/local/apache2/lib/libexpat.so.0 (0x00007f2f68340000)
libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f2f68107000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f2f67f03000)
/lib64/ld-linux-x86-64.so.2 (0x00007f2f691c7000)
上一篇:linux服务器修改ssh默认22端口方法
下一篇:Fedora10编程开发工具