在 CentOS 7 上编译 PHP 时如何修复 OpenSSL 错误 "libssl.so.10, needed by lib64/libldap.so, may conflict with libssl.so.1.1"?
How do I fix OpenSSL Error "libssl.so.10, needed by lib64/libldap.so, may conflict with libssl.so.1.1" when Compiling PHP on CentOS 7?
我开始完全干净地安装 CentOS 7,没有安装任何东西。
开始时,我yum install
编辑了这些 RPM:
- 制作
- 定位
- pcre-开发
- 海外发展
- epel-release
- libxml2-devel
- yum-utils
- wget
- vim
- 山猫
- libnghttp2-devel
- libnghttp2
- nghttp2
- libpng-devel
- gcc*
- perl-Module-Load-Conditional
- perl 核心
- 卷曲发展
- openssl-devel
- mariadb-devel
- unixODBC-devel
- bzip2-devel
- libjpeg-devel
- libXpm-devel
- freetype-devel
- gmp-devel
- libmcrypt-devel
- httpd-devel
** 分辨率编辑 **
添加了以下 RPMS:
- cyrus-sasl
- cyrus-sasl-devel
我已经使用以下相应命令从源代码编译了 OpenSSL 1.1.1、cURL 7.62.0 和 HTTPD 2.4.38:
OpenSSL
$ ./config \
--prefix=/opt/openssl \
-Wl,-rpath=/opt/openssl/bin \
--openssldir=/opt/openssl \
shared \
zlib
$ make clean
$ make
$ make install
$ openssl version
OpenSSL 1.1.1 11 Sep 2018
cURL
$ env PKG_CONFIG_PATH=/opt/openssl/lib/pkgconfig ./configure \
--prefix=/opt/curl \
--with-ssl \
LDFLAGS="-L/opt/openssl/lib -Wl,-rpath,/opt/openssl/lib"
CPPFLAGS="-I/opt/openssl/include -Wl,-rpath,/opt/openssl/include"
make clean
make
make install
$ curl -V
curl 7.62.0 (x86_64-pc-linux-gnu) libcurl/7.62.0 OpenSSL/1.1.1 zlib/1.2.7 nghttp2/1.31.1
Release-Date: 2018-10-31
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy
HTTPD
$ env PKG_CONFIG_PATH=/opt/openssl/lib/pkgconfig ./configure \
--prefix=/opt/httpd \
--with-included-apr \
--enable-so \
--with-port=80 \
--enable-http2 \
--enable-ssl \
--enable-ssl=shared \
--with-ssl=/opt/openssl \
--with-curl=/opt/curl \
LDFLAG="-L/opt/openssl/lib -Wl,-rpath,/opt/openssl/lib -L/opt/curl/lib -Wl,-rpath,/opt/curl/lib" \
CPPFLAGS="-I/opt/openssl/include -Wl,-rpath,/opt/openssl/include -I/opt/curl/include -Wl,-rpath,/opt/curl/include"
$ make clean
$ make
$ make install
$ httpd -v
Server version: Apache/2.4.38 (Unix)
Server built: Mar 13 2019 15:14:01
到目前为止一切正常。我能够通过远程计算机上的浏览器加载 HTML 页面。 (开启80端口后)
这是我开始 运行 遇到问题的地方。
** OPENLDAP 编辑(通过编译 OPEN LDAP 解决)**
$ env PKG_CONFIG_PATH=/opt/openssl/lib/pkgconfig ./configure \
--prefix=/opt/openldap \
--with-tls \
LDFLAGS="-L/opt/openssl/lib -Wl,-rpath,/opt/openssl/lib" \
CPPFLAGS="-I/opt/openssl/include -Wl,-rpath,/opt/openssl/include"
$ make clean
$ make depend
$ make
$ make install
PHP
$ env PKG_CONFIG_PATH=/opt/openssl/lib/pkgconfig ./configure \
--with-apxs2=/opt/httpd/bin/apxs \
--prefix=/opt/php \
--with-mysqli \
--with-pdo-mysql \
--enable-pdo \
--enable-ftp \
--with-zlib \
--enable-zip \
--enable-mbstring \
--with-curl=/opt/curl \
--with-openssl \
--with-openssl-dir=/opt/openssl \
--enable-exif \
--with-gd \
--enable-shared \
--enable-cgi \
--with-ldap=/opt/openldap \
LDFLAGS="-Wl,-rpath,/opt/openldap/lib -L/opt/openldap/lib -Wl,-rpath,/opt/openssl/lib -L/opt/openssl/lib" \
CPPFLAGS="-Wl,-rpath,/opt/openldap/include -I/opt/openldap/include -Wl,-rpath,/opt/openssl/include -I/opt/openssl/include"
$ make clean
$ make
$ make install
出错
运行 make clean;make
我收到了这个错误:
/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
/usr/bin/ld: ext/openssl/.libs/xp_ssl.o: undefined reference to symbol 'SSLv3_server_method@@libssl.so.10'
//usr/lib64/libssl.so.10: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
制作测试日志
make test
命令returns同样的错误。
/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
/usr/bin/ld: ext/openssl/.libs/xp_ssl.o: undefined reference to symbol 'SSLv3_server_method@@libssl.so.10'
//usr/lib64/libssl.so.10: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
要停止此警告,请使用系统 SSL-Library,不要自行编译。
或者您必须自己构建您正在使用的所有库,link 针对 OpenSSL(在您的情况下是 libldap)
我开始完全干净地安装 CentOS 7,没有安装任何东西。
开始时,我yum install
编辑了这些 RPM:
- 制作
- 定位
- pcre-开发
- 海外发展
- epel-release
- libxml2-devel
- yum-utils
- wget
- vim
- 山猫
- libnghttp2-devel
- libnghttp2
- nghttp2
- libpng-devel
- gcc*
- perl-Module-Load-Conditional
- perl 核心
- 卷曲发展
- openssl-devel
- mariadb-devel
- unixODBC-devel
- bzip2-devel
- libjpeg-devel
- libXpm-devel
- freetype-devel
- gmp-devel
- libmcrypt-devel
- httpd-devel
** 分辨率编辑 ** 添加了以下 RPMS:
- cyrus-sasl
- cyrus-sasl-devel
我已经使用以下相应命令从源代码编译了 OpenSSL 1.1.1、cURL 7.62.0 和 HTTPD 2.4.38:
OpenSSL
$ ./config \
--prefix=/opt/openssl \
-Wl,-rpath=/opt/openssl/bin \
--openssldir=/opt/openssl \
shared \
zlib
$ make clean
$ make
$ make install
$ openssl version
OpenSSL 1.1.1 11 Sep 2018
cURL
$ env PKG_CONFIG_PATH=/opt/openssl/lib/pkgconfig ./configure \
--prefix=/opt/curl \
--with-ssl \
LDFLAGS="-L/opt/openssl/lib -Wl,-rpath,/opt/openssl/lib"
CPPFLAGS="-I/opt/openssl/include -Wl,-rpath,/opt/openssl/include"
make clean
make
make install
$ curl -V
curl 7.62.0 (x86_64-pc-linux-gnu) libcurl/7.62.0 OpenSSL/1.1.1 zlib/1.2.7 nghttp2/1.31.1
Release-Date: 2018-10-31
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy
HTTPD
$ env PKG_CONFIG_PATH=/opt/openssl/lib/pkgconfig ./configure \
--prefix=/opt/httpd \
--with-included-apr \
--enable-so \
--with-port=80 \
--enable-http2 \
--enable-ssl \
--enable-ssl=shared \
--with-ssl=/opt/openssl \
--with-curl=/opt/curl \
LDFLAG="-L/opt/openssl/lib -Wl,-rpath,/opt/openssl/lib -L/opt/curl/lib -Wl,-rpath,/opt/curl/lib" \
CPPFLAGS="-I/opt/openssl/include -Wl,-rpath,/opt/openssl/include -I/opt/curl/include -Wl,-rpath,/opt/curl/include"
$ make clean
$ make
$ make install
$ httpd -v
Server version: Apache/2.4.38 (Unix)
Server built: Mar 13 2019 15:14:01
到目前为止一切正常。我能够通过远程计算机上的浏览器加载 HTML 页面。 (开启80端口后)
这是我开始 运行 遇到问题的地方。
** OPENLDAP 编辑(通过编译 OPEN LDAP 解决)**
$ env PKG_CONFIG_PATH=/opt/openssl/lib/pkgconfig ./configure \
--prefix=/opt/openldap \
--with-tls \
LDFLAGS="-L/opt/openssl/lib -Wl,-rpath,/opt/openssl/lib" \
CPPFLAGS="-I/opt/openssl/include -Wl,-rpath,/opt/openssl/include"
$ make clean
$ make depend
$ make
$ make install
PHP
$ env PKG_CONFIG_PATH=/opt/openssl/lib/pkgconfig ./configure \
--with-apxs2=/opt/httpd/bin/apxs \
--prefix=/opt/php \
--with-mysqli \
--with-pdo-mysql \
--enable-pdo \
--enable-ftp \
--with-zlib \
--enable-zip \
--enable-mbstring \
--with-curl=/opt/curl \
--with-openssl \
--with-openssl-dir=/opt/openssl \
--enable-exif \
--with-gd \
--enable-shared \
--enable-cgi \
--with-ldap=/opt/openldap \
LDFLAGS="-Wl,-rpath,/opt/openldap/lib -L/opt/openldap/lib -Wl,-rpath,/opt/openssl/lib -L/opt/openssl/lib" \
CPPFLAGS="-Wl,-rpath,/opt/openldap/include -I/opt/openldap/include -Wl,-rpath,/opt/openssl/include -I/opt/openssl/include"
$ make clean
$ make
$ make install
出错
运行 make clean;make
我收到了这个错误:
/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
/usr/bin/ld: ext/openssl/.libs/xp_ssl.o: undefined reference to symbol 'SSLv3_server_method@@libssl.so.10'
//usr/lib64/libssl.so.10: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
制作测试日志
make test
命令returns同样的错误。
/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
/usr/bin/ld: ext/openssl/.libs/xp_ssl.o: undefined reference to symbol 'SSLv3_server_method@@libssl.so.10'
//usr/lib64/libssl.so.10: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
要停止此警告,请使用系统 SSL-Library,不要自行编译。
或者您必须自己构建您正在使用的所有库,link 针对 OpenSSL(在您的情况下是 libldap)