启动 nginx 时报错:error while loading shared libraries:

作者:佚名 上传时间:2019-03-21 版权申诉

Nginx 启动出错 error while loading shared libraries: libpcre.so.1

error while loading shared libraries: libpcre.so.1

启动 nginx 时报错:

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

查看依赖库

ldd $(which /usr/local/nginx/sbin/nginx)
    linux-vdso.so.1 (0x00007ffff1599000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fe954f5b000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe954d3c000)
    libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007fe954b04000)
    libluajit-5.1.so.2 => /usr/local/lib/libluajit-5.1.so.2 (0x00007fe954894000)
    libpcre.so.1 => not found
    libssl.so.1.1 => /usr/lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007fe95462a000)
    libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007fe9541b2000)
    libz.so.1 => /usr/local/lib/libz.so.1 (0x00007fe953f94000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe953ba3000)    /lib64/ld-linux-x86-64.so.2 (0x00007fe9554b0000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe953805000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fe9535ed000)

猜测可能有以下 3 种原因:

  1. 未安装 PCRE

  2. libpcre.so.1 名字不对

  3. 未设置 LD_LIBRARY_PATH

安装 PCRE,不用多说。安装完之后仍出现以上报错呢。?

find / -name libpcre.so.1

发现找不到 libpcre.so.1 怎么办

到 /usr/local/lib 目录下查看

ls -l libpcre.so*lrwxrwxrwx 1 root root     17 7月   4 09:06 libpcre.so -> libpcre.so.1.2.10-rwxr-xr-x 1 root root 508296 7月   4 09:06 libpcre.so.1.2.10

发现原来是名字不对,遂设置软连接

ln -s /usr/local/lib/libpcre.so.1.2.10 libpcre.so.1

设置完软连接重启 nginx 发现仍然无法解决问题。

设置 LD_LIBRARY_PATH

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

查看依赖库

ldd $(which /usr/local/nginx/sbin/nginx)
    linux-vdso.so.1 (0x00007ffda9323000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f01627f9000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f01625da000)
    libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f01623a2000)
    libluajit-5.1.so.2 => /usr/local/lib/libluajit-5.1.so.2 (0x00007f0162132000)
    libpcre.so.1 => /usr/local/lib/libpcre.so.1 (0x00007f0161f14000)
    libssl.so.1.1 => /usr/lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007f0161caa000)
    libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007f0161832000)
    libz.so.1 => /usr/local/lib/libz.so.1 (0x00007f0161614000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0161223000)    /lib64/ld-linux-x86-64.so.2 (0x00007f0162d4e000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f0160e85000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f0160c6d000)

最终,问题解决。


免责申明:文章和图片全部来源于公开网络,如有侵权,请通知删除 server@dude6.com

用户评论
相关推荐
启动 nginx报错error while loading shared libraries:
Nginx 启动出错 error while loading shared libraries: libpcre.so.1error while loading shared l
error while loading shared libraries xx.so处理方法
一般我们在Linux下执行某些外部程序的时候可能会提示找不到共享库的错误, 比如: tmux: error while loading shared libraries: libevent-1.4.s
PDF
45KB
2021-01-16 03:32
Nginx 启动出错 error while loading shared libraries: libpcre.so.1
在 centos 6.5  64位上编译安装nginx1.63语法检查出错 [root @localhost conf]# /usr/local/nginx/sbin/
安装ImageMagick出现error while loading shared libraries的解决方法
主要介绍了安装ImageMagick出现error while loading shared libraries的解决方法,是ImageMagick安装与运行中经常出现的问题,需要的朋友可以参考下
PDF
30KB
2020-11-22 00:01
MYSQL之error while loading shared libraries libtinfo.so.5cannot open shared o
MYSQL之 error while loading shared libraries: libtinfo.so.5: cannot open shared objectfile: No such f
TXT
23B
2021-04-07 10:07
解决启动MongoDB错误error while loading shared libraries libstdc++.so.6cannot open s
本文提供了解启动MongoDB时提示:error while loading shared libraries: libstdc++.so.6: cannot open shared object f
PDF
30KB
2020-09-15 02:20
解决启动MongoDB错误error while loading shared libraries libstdc++.so.6cannot open s
启动MongoDB时,提示: error while loading shared libraries: libstdc++.so.6: cannot open shared object file:
PDF
39KB
2020-12-17 10:52
解决启动MongoDB错误error while loading shared libraries libstdc++.so.6cannot open s
启动MongoDB时,提示:error while loading shared libraries: libstdc++.so.6: cannot open shared object file:
pdf
43.54 KB
2021-09-01 18:30
error while loading shared libraries的解決方法
在linux下运行程序时,发现了error while loading shared libraries这种错误,一时间不知道解决办法,在网上搜索,终于解决了: ./te
error while loading shared libraries: libtinfo.so.5
想通过ansible在管理的各数据库服务器执行操作数据库的一个shell脚本,跑脚本的时候发现部分服务器能执行成功,部分服务器失败了,报错信息为error while loading sha