php5.6.27编译(make && make install)报错,且无法解决。报错内容如下:

/usr/develop/php-5.6.27/ext/openssl/openssl.c:3485:14: error: dereferencing pointer to incomplete type 'EVP_PKEY' {aka 'struct evp_pkey_st'}
switch (pkey->type) {
^~
/usr/develop/php-5.6.27/ext/openssl/openssl.c: In function 'php_openssl_pkey_init_dsa':
/usr/develop/php-5.6.27/ext/openssl/openssl.c:3557:10: error: dereferencing pointer to incomplete type 'DSA' {aka 'struct dsa_st'}
if (!dsa->p || !dsa->q || !dsa->g) {
^~
/usr/develop/php-5.6.27/ext/openssl/openssl.c: In function 'php_openssl_pkey_init_dh':
/usr/develop/php-5.6.27/ext/openssl/openssl.c:3580:9: error: dereferencing pointer to incomplete type 'DH' {aka 'struct dh_st'}


原因:php5.6.27和openssl1.1.1c不兼容。

我查看了我的openssl版本是:

[root@node3 php-5.6.27]# openssl version
OpenSSL 1.1.1c FIPS 28 May 2019


初步解决方法:把openssl的版本降级,我选择的是openssl-1.0.0c。重新编译安装,就不会有编译错误了。

yum remove -y openssl
cd /usr/apps/
wget -c ftp://ftp.openssl.org/source/openssl-1.0.0c.tar.gz
tar -zxf openssl-1.0.0c.tar.gz
cd openssl-1.0.0c/
./config --prefix=/usr/local --openssldir=/usr/local/ssl
make && make install
./config shared --prefix=/usr/local --openssldir=/usr/local/ssl
make clean
make && make install
openssl version # 查看版本


发现没用,总是有各种各样的问题。

最终解决方法:安装php7.3.13。

​安装参考链接​