解决Nginx报error while loading shared libraries: libjemalloc.so.2: cannot open
遇见Nginx启动不了,重装也不行
1:执行如下命令查看下nginx启动时调用的库文件
ldd /www/server/nginx/sbin/nginx
执行后显示如下:
[root@blog.tag.gg~]# ldd /www/server/nginx/sbin/nginx linux-vdso.so.1 => (0x00007ffd36fa7000) libjemalloc.so.2 => not found libdl.so.2 => /lib64/libdl.so.2 (0x00007fdacbecc000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fdacbcb0000) libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007fdacba79000) libluajit-5.1.so.2 => not found libm.so.6 => /lib64/libm.so.6 (0x00007fdacb777000) libz.so.1 => /lib64/libz.so.1 (0x00007fdacb561000) libxml2.so.2 => /lib64/libxml2.so.2 (0x00007fdacb1f7000) libxslt.so.1 => /lib64/libxslt.so.1 (0x00007fdacafb8000) libexslt.so.0 => /lib64/libexslt.so.0 (0x00007fdacada3000) libgd.so.2 => /lib64/libgd.so.2 (0x00007fdacab5c000) libc.so.6 => /lib64/libc.so.6 (0x00007fdaca78e000) /lib64/ld-linux-x86-64.so.2 (0x00007fdacc0d0000) libfreebl3.so => /lib64/libfreebl3.so (0x00007fdaca58b000) liblzma.so.5 => /lib64/liblzma.so.5 (0x00007fdaca365000) libgcrypt.so.11 => /lib64/libgcrypt.so.11 (0x00007fdaca0e4000) libgpg-error.so.0 => /lib64/libgpg-error.so.0 (0x00007fdac9edf000) libXpm.so.4 => /lib64/libXpm.so.4 (0x00007fdac9ccd000) libX11.so.6 => /lib64/libX11.so.6 (0x00007fdac998f000) libjpeg.so.62 => /lib64/libjpeg.so.62 (0x00007fdac973a000) libfontconfig.so.1 => /lib64/libfontconfig.so.1 (0x00007fdac94f8000) libfreetype.so.6 => /lib64/libfreetype.so.6 (0x00007fdac9239000) libpng15.so.15 => /lib64/libpng15.so.15 (0x00007fdac900e000) libxcb.so.1 => /lib64/libxcb.so.1 (0x00007fdac8de6000) libexpat.so.1 => /lib64/libexpat.so.1 (0x00007fdac8bbb000) libuuid.so.1 => /lib64/libuuid.so.1 (0x00007fdac89b6000) libbz2.so.1 => /lib64/libbz2.so.1 (0x00007fdac87a6000) libXau.so.6 => /lib64/libXau.so.6 (0x00007fdac85a2000)
执行结果看提示“libjemalloc.so.2”和 “libluajit-5.1.so.2”找不到。
2、执行如下命令搜索一下文件是否存在。
find / -name libjemalloc.so.2 find / -name libluajit-5.1.so.2
执行后显示如下,系统中是存在这个文件的。
[root@blog.tag.gg~]# find / -name libjemalloc.so.2 /usr/local/lib/libjemalloc.so.2 [root@blog.tag.gg~]# find / -name libluajit-5.1.so.2 /usr/local/lib64/libluajit-5.1.so.2 /usr/local/lib/libluajit-5.1.so.2 [root@blog.tag.gg~]#
3、将“libjemalloc.so.2”和 “libluajit-5.1.so.2”文件复制到 /lib64/即可。
[root@blog.tag.gg~]# cp /usr/local/lib/libjemalloc.so.2 /lib64/ [root@blog.tag.gg~]# cp /usr/local/lib64/libluajit-5.1.so.2 /lib64/
php的问题也是类似解决方案
链接:
https://blog.tag.gg/showinfo-7-36284-0.html