php7配置:错误:找不到libcrypto

问题描述

我正在使用

编译PHP-7.3.22
'./configure' \
'--prefix=/usr/local/PHP7' \
'--with-apxs2=/usr/local/apache2/bin/apxs' \
'--with-config-file-path=/usr/local/PHP7/conf' \
'--with-curl=/usr' \
'--with-openssl=/usr/local/ssl' \
'--with-openssl-dir=/usr/local/ssl'

在配置过程中出现以下错误

checking for pkg-config... /bin/pkg-config
checking for OpenSSL version... >= 1.0.1
checking for CRYPTO_free in -lcrypto... no
configure: error: libcrypto not found!

以下是操作系统信息:

**$ uname -a**
Linux internal 4.18.0-193.19.1.el8_2.x86_64 #1 SMP Wed Aug 26 15:29:02 EDT 2020 x86_6                           4 x86_64 x86_64 GNU/Linux

**$ cat /etc/redhat-release**
Red Hat Enterprise Linux release 8.2 (Ootpa)

我已经安装了openss-1.1.1h

sudo ./config --prefix=/usr/local/ss/ --openssldir=/usr/local/ssl shared
sudo make
sudo make test
sudo make install

已安装OpenSSL并报告其正确版本:

$ /usr/local/ssl/bin/openssl version
OpenSSL 1.1.1h  22 Sep 2020 (Library: OpenSSL 1.1.1c FIPS  28 May 2019)

lib文件显示libcrypto在其中。

$ ls -al /usr/local/ssl/lib/
total 10464
drwxr-xr-x.  4 root root     159 Sep 24 15:20 .
drwxr-xr-x. 10 root root     201 Sep 24 15:20 ..
drwxr-xr-x.  2 root root      55 Sep 24 15:20 engines-1.1
-rw-r--r--.  1 root root 5635122 Sep 24 15:20 libcrypto.a
lrwxrwxrwx.  1 root root      16 Sep 24 15:20 libcrypto.so -> libcrypto.so.1.1
-rwxr-xr-x.  1 root root 3359896 Sep 24 15:20 libcrypto.so.1.1
-rw-r--r--.  1 root root 1027768 Sep 24 15:20 libssl.a
lrwxrwxrwx.  1 root root      13 Sep 24 15:20 libssl.so -> libssl.so.1.1
-rwxr-xr-x.  1 root root  686168 Sep 24 15:20 libssl.so.1.1
drwxr-xr-x.  2 root root      61 Sep 24 01:46 pkgconfig

libcrypto文件都在那里。

$ sudo find /  -name "libcrypto*so*"
/usr/lib64/libcrypto.so.1.1
/usr/lib64/libcrypto.so.1.1.1c
/usr/lib64/libcrypto.so
/usr/local/src/openssl-1.1.1h/libcrypto.so.1.1
/usr/local/src/openssl-1.1.1h/libcrypto.so
/usr/local/ssl/lib/libcrypto.so.1.1
/usr/local/ssl/lib/libcrypto.so

操作系统也随供应商提供的OpenSSL一起安装

$ rpm -qa | grep openssl
openssl-devel-1.1.1c-15.el8.x86_64
openssl-1.1.1c-15.el8.x86_64
openssl-libs-1.1.1c-15.el8.x86_64
openssl-pkcs11-0.4.10-2.el8.x86_64

以下信息来自config.log

| /* Override any GCC internal prototype to avoid an error.
|    Use char because int might match the return type of a GCC
|    builtin and then its argument prototype would still apply.  */
| #ifdef __cplusplus
| extern "C"
| #endif
| char CRYPTO_free ();
| int
| main ()
| {
| return CRYPTO_free ();
|   ;
|   return 0;
| }
configure:19188: result: no
configure:19226: error: libcrypto not found!

## ---------------- ##

我想念什么?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)