【程序运行时找不到库文件】nginx: error while loading shared libraries: libpcre.so.1

【程序运行时候找不到库文件】


Spreddit3
name="fb_xdm_frame_http" frameborder="0" allowtransparency="true" scrolling="no" id="fb_xdm_frame_http" aria-hidden="true" title="Facebook Cross Domain Communication Frame" tabindex="-1" src="http://static.ak.facebook.com/connect/xd_arbiter/7r8gQb8MIqE.js?version=41#channel=f2d5f2c37&origin=http%3A%2F%2Fchandank.com" style="max-width: 100%; border-style: none;"> name="fb_xdm_frame_https" frameborder="0" allowtransparency="true" scrolling="no" id="fb_xdm_frame_https" aria-hidden="true" title="Facebook Cross Domain Communication Frame" tabindex="-1" src="https://s-static.ak.facebook.com/connect/xd_arbiter/7r8gQb8MIqE.js?version=41#channel=f2d5f2c37&origin=http%3A%2F%2Fchandank.com" style="max-width: 100%; border-style: none;">
name="f3235b17c4" width="90px" height="1000px" frameborder="0" allowtransparency="true" scrolling="no" title="fb:like Facebook Social Plugin" src="http://www.facebook.com/plugins/like.php?action=like&app_id=&channel=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter%2F7r8gQb8MIqE.js%3Fversion%3D41%23cb%3Df3945eab98%26domain%3Dchandank.com%26origin%3Dhttp%253A%252F%252Fchandank.com%252Ff2d5f2c37%26relation%3Dparent.parent&color_scheme=light&href=http%3A%2F%2Fchandank.com%2Fwebservers%2Fnginx%2Fnginx-error-while-loading-shared-libraries-libpcre-so-1&layout=standard&locale=en_US&sdk=joey&send=true&show_faces=false&width=90" style="max-width: 100%; position: absolute; border-style: none; visibility: visible; width: 0px; height: 0px;">


【解决办法:1.找下你需要的库是否存在:查找下usr/local/lib

2.如果存在这个库的话,通过设置LD_LIBRARY_PATH=/usr/local/lib: 这个环境变量,把库的路径加进去

3.重新编译程序运行看看。

原理:

系统对动态库查找规则:
/lib
/usr/lib
到环境变量LD_LIBRARY_PATH指定的路径中查找 /etc/profile 下面有显示路径 环境变量,每个目录用 : 分割  window目录分割用 ;
【1.在文件/etc/profile改  2.export LD_LIBRARY_PATH=:.:~(当前用户主目录):..:~soft01(soft01用户的主目录)】

$./nginx

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

$

If you are getting above error while starting nginx, you can fix by following.

This generally happens due to following three reasons.

  1. You don’t have PCRE installed
  2. Nginx was not complied & installed using pcre
  3. PCRE library is not set in LD_LIBRARY_PATH

There are multiple ways to fix this issue. The best way I believe is using troubleshooting skills. Let’s understand the error and fix it accordingly.

nginx: error while loading shared libraries: libpcre.so.1

nginx is looking for file libpcre.so.1 which comes under PCRE library and usually installed on UNIX.

  • Let’s find libpcre.so.1 using find command
$find / -name libpcre.so.1
/usr/local/lib/libpcre.so.1
$

Ok, so I do have this file which means PCRE is already installed and will proceed with next troubleshooting step.

Note: If you don’t get find results then you got to install PCRE. You can either install using yum install pcre on Linux/CentOS or can ask system administrator to install it.

  • Now, let’s set LD_LIBRARY_PATH as we could see libpcre.so.1 is available under /usr/local/lib
$export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
  • Start nginx now, you should be able to start.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值