php 5.6 安装openssl extension 出现编译错误

废话不多说,直接上问题:

 

PHP和openssl extension都是最新版本的,标准步骤安装时候出现如下问题:

php:php-5.6.27

openssl:openssl-1.1.0e

 

================================

/root/software/php/php-5.6.27/ext/openssl/openssl.c:3536:31: error: dereferencing pointer to incomplete type
int len = BN_num_bytes(pkey->pkey._type->_name); \
^
/usr/local/openssl/include/openssl/bn.h:142:40: note: in definition of macro ‘BN_num_bytes’
# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
^
/root/software/php/php-5.6.27/ext/openssl/openssl.c:3982:5: note: in expansion of macro ‘OPENSSL_PKEY_GET_BN’
OPENSSL_PKEY_GET_BN(dh, g);
^
/root/software/php/php-5.6.27/ext/openssl/openssl.c:3538:18: error: dereferencing pointer to incomplete type
BN_bn2bin(pkey->pkey._type->_name, (unsigned char*)str); \
^
/root/software/php/php-5.6.27/ext/openssl/openssl.c:3982:5: note: in expansion of macro ‘OPENSSL_PKEY_GET_BN’
OPENSSL_PKEY_GET_BN(dh, g);
^
/root/software/php/php-5.6.27/ext/openssl/openssl.c:3535:11: error: dereferencing pointer to incomplete type
if (pkey->pkey._type->_name != NULL) { \
^
/root/software/php/php-5.6.27/ext/openssl/openssl.c:3983:5: note: in expansion of macro ‘OPENSSL_PKEY_GET_BN’
OPENSSL_PKEY_GET_BN(dh, priv_key);
^
In file included from /usr/local/openssl/include/openssl/asn1.h:24:0,
from /usr/local/openssl/include/openssl/objects.h:916,
from /usr/local/openssl/include/openssl/evp.h:27,
from /root/software/php/php-5.6.27/ext/openssl/openssl.c:44:
/root/software/php/php-5.6.27/ext/openssl/openssl.c:3536:31: error: dereferencing pointer to incomplete type
int len = BN_num_bytes(pkey->pkey._type->_name); \
^
/usr/local/openssl/include/openssl/bn.h:142:40: note: in definition of macro ‘BN_num_bytes’
# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
^
/root/software/php/php-5.6.27/ext/openssl/openssl.c:3983:5: note: in expansion of macro ‘OPENSSL_PKEY_GET_BN’
OPENSSL_PKEY_GET_BN(dh, priv_key);
^
/root/software/php

================================

 

在网上搜索了一圈,都没有答案。

于是打开代码看来一下,看来某些定义的头文件没有引用进来。

但如本人才疏学浅,对openssl没有整体的把握,所以就对比了之前的openssl版本,发现版本升级后,代码是有变化的。

具体细节大家可以自己去看。

 

解决办法就是:

把openssl的版本降级,我选择的是openssl-0.9.8v。

重新编译安装,就不会有编译错误了。

 

posted @ 2017-04-18 11:04  他山之小石头  阅读(2839)  评论(0编辑  收藏  举报