after installed nginx, got some error message when raunch as: `/opt/nginx/sbin/nginx`
/opt/nginx/sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
still i’m sure i’ve installed the latest pcre. and also i can find the libpcre.so.1 with:
find /usr/ -name "libpcre.so.1" /usr/local/lib/libpcre.so.1
ok, why cannot found the libpcre.so.1 in `/user/local/lib` ??
So how does the dynamic loader know where to look for executables? As with many things on Linux, there is a configuration file in /etc. In fact, there are two configuration files, /etc/ld.so.conf and /etc/ld.so.cache. Note that /etc/ld.so.conf specifies that all the .conf files from the subdirectory ld.so.conf.d should be included.
Dynamic library configuration
ldconfig -p | grep "libpcre.so.1"
not found any matches.
so the problem is the dynamic loader not serach for my lib dir in /usr/local/lib
For the current session you can
or to make the change permanent you can add /usr/local/lib to /etc/ld.so.conf (or something it includes) and run `ldconfig` as root.
keep reading. If not, read aboout ldconfig first.
after all, grep it:
ldconfig -p | grep "libpcre.so.1" libpcre.so.1 (libc6,x86-64) => /usr/local/lib/libpcre.so.1
ok, got it!
run again /opt/nginx/sbin/nginx
these are some keyword need to read for details: `strace`, `ldconfig`, `/etc/ld.conf`, `/etc/ld.conf.cache`.