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


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

    从错误提示信息可以得知是因为缺少lib文件导致,进一步查看具体内容:

    1 # ldd $(which /usr/local/nginx/sbin/nginx)
    2     libpthread.so.0 => /lib64/libpthread.so.0 (0x00000030e8400000)
    3     libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00000030f9a00000)
    4     libpcre.so.1 => not found
    5     libcrypto.so.6 => /lib64/libcrypto.so.6 (0x00000030f2a00000)
    6     libz.so.1 => /lib64/libz.so.1 (0x00000030e8800000)
    7     libc.so.6 => /lib64/libc.so.6 (0x00000030e7800000)
    8     /lib64/ld-linux-x86-64.so.2 (0x00000030e7400000)
    9     libdl.so.2 => /lib64/libdl.so.2 (0x00000030e8000000)

    查看结果显示 : libpcre.so.1 => not found ,同时注意lib库的路径,有/lib/* 和 /lib64/* 之分。

    比如上面的是 /lib64/*,这个和下面解决问题时创建的软连接有关系

    解决办法:

    1、首先确认已经安装好pcre 软件(nginx 依赖该软件)

    2、创建软连接

    对于/lib/* 32位系统来说:

    1 #查看lib库
    2 #  ls /lib/ |grep pcre
    3 libpcre.so.0
    4 libpcre.so.0.0.1
    5 #添加软连接
    6 # ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1

    ps: 也有可能 pcre lib文件在目录:/usr/local/lib/

    对于/lib64/* 64位系统来说:

    1 #查看lib库
    2 #  ls /lib64/ |grep pcre
    3 libpcre.so.0
    4 libpcre.so.0.0.1
    5 #添加软连接
    6 # ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1

    ps: 也有可能 pcre lib文件在目录:/usr/local/lib64/。

  • 相关阅读:
    每天一道LeetCode--141.Linked List Cycle(链表环问题)
    每天一道LeetCode--119.Pascal's Triangle II(杨辉三角)
    每天一道LeetCode--118. Pascal's Triangle(杨辉三角)
    CF1277D Let's Play the Words?
    CF1281B Azamon Web Services
    CF1197D Yet Another Subarray Problem
    CF1237D Balanced Playlist
    CF1239A Ivan the Fool and the Probability Theory
    CF1223D Sequence Sorting
    CF1228D Complete Tripartite
  • 原文地址:https://www.cnblogs.com/xzlive/p/10478453.html
Copyright © 2020-2023  润新知