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。

重新編譯安裝,就不會有編譯錯誤了。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM