今天在打一个LAMP的架构时,为了快速部署就直接使用了yum 安装了httpd/mysql/php等组件。但是在httpd服务启动过程中发现服务一直启动不了,在error_log里面发现有以下内容,
/usr/sbin/httpd: symbol lookup error: /usr/lib64/libaprutil-1.so.0: undefined symbol: apr_os_uuid_get[Wed Nov 08 09:22:40 2017] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)[Wed Nov 08 09:22:40 2017] [notice] Digest: generating secret for digest authentication ...[Wed Nov 08 09:22:40 2017] [notice] Digest: done
刚开始以为apr组件安装的不对就卸了重装,把httpd也卸了重装,但是还是没有解决问题。
后来使用ldconfig -p|grep apr 命令查看库文件
root># ldconfig -p | grep apr libaprutil-1.so.0 (libc6,x86-64) => /usr/lib64/libaprutil-1.so.0 libapr-1.so.0 (libc6,x86-64) => /usr/lib64/libapr-1.so.0
对照
root># httpd -V Server version: Apache/2.2.15 (Unix) Server built: Oct 19 2017 16:43:38 Server‘s Module Magic Number: 20051115:25 Server loaded: APR 1.6.3, APR-Util 1.3.9 #加载的是我编译安装的文件 Compiled using: APR 1.3.9, APR-Util 1.3.9 Architecture: 64-bit Server MPM: Prefork threaded: no forked: yes (variable process count) Server compiled with.... -D APACHE_MPM_DIR="server/mpm/prefork" -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D DYNAMIC_MODULE_LIMIT=128 -D HTTPD_ROOT="/etc/httpd" -D SUEXEC_BIN="/usr/sbin/suexec" -D DEFAULT_PIDLOG="run/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_LOCKFILE="logs/accept.lock" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf" You have new mail in /var/spool/mail/root
然后查看库文件路径 LD_LIBRARY_PATH发现只有/usr/local/apr/lib
root># echo $LD_LIBRARY_PATH :/usr/local/apr/lib
但是真正安装的libapr文件在/usr/lib64下
root># LD_LIBRARY_PATH=/usr/lib64:$LD_LIBRARY_PATH #添加/usr/lib64到路径下 root># echo $LD_LIBRARY_PATH /usr/lib64::/usr/local/apr/lib
然后再次尝试启动httpd服务,他喵的成功了 〒▽〒
/etc/init.d/httpd start Starting httpd: [ok]
时间: 2024-10-04 09:54:29