OLS PHP 5.6 wont compile with openssl error

#1
Hi,
I am attempting to compile and install php 5.6.40 on Ubuntu 20.04.6 LTS using Tools -> Compile PHP and got the below error.
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:664:4: warning: ‘ASN1_STRING_data’ is deprecated [-Wdeprecated-declarations]
664 | to_add = ASN1_STRING_data(str);
| ^~~~~~
In file included from /usr/include/openssl/evp.h:13,
from /usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:44:
/usr/include/openssl/asn1.h:554:1: note: declared here
554 | DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x))
| ^~~~~~~~~~~~~~~~~~
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c: In function ‘asn1_time_to_time_t’:
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:717:2: warning: ‘ASN1_STRING_data’ is deprecated [-Wdeprecated-declarations]
717 | if (ASN1_STRING_length(timestr) != strlen((const char*)ASN1_STRING_data(timestr))) {
| ^~
In file included from /usr/include/openssl/evp.h:13,
from /usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:44:
/usr/include/openssl/asn1.h:554:1: note: declared here
554 | DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x))
| ^~~~~~~~~~~~~~~~~~
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:732:2: warning: ‘ASN1_STRING_data’ is deprecated [-Wdeprecated-declarations]
732 | strbuf = estrdup((char *)ASN1_STRING_data(timestr));
| ^~~~~~
In file included from /usr/include/openssl/evp.h:13,
from /usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:44:
/usr/include/openssl/asn1.h:554:1: note: declared here
554 | DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x))
| ^~~~~~~~~~~~~~~~~~
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c: In function ‘php_openssl_get_evp_md_from_algo’:
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:1057:24: warning: implicit declaration of function ‘EVP_dss1’ [-Wimplicit-function-declaration]
1057 | mdtype = (EVP_MD *) EVP_dss1();
| ^~~~~~~~
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:1057:13: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
1057 | mdtype = (EVP_MD *) EVP_dss1();
| ^
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c: In function ‘zif_openssl_spki_export_challenge’:
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:1726:2: warning: ‘ASN1_STRING_data’ is deprecated [-Wdeprecated-declarations]
1726 | RETVAL_STRING((char *) ASN1_STRING_data(spki->spkac->challenge), 1);
| ^~~~~~~~~~~~~
In file included from /usr/include/openssl/evp.h:13,
from /usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:44:
/usr/include/openssl/asn1.h:554:1: note: declared here
554 | DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x))
| ^~~~~~~~~~~~~~~~~~
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c: In function ‘openssl_x509v3_subjectAltName’:
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:1904:15: error: dereferencing pointer to incomplete type ‘X509_EXTENSION’ {aka ‘struct X509_extension_st’}
1904 | p = extension->value->data;
| ^~
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:1925:6: warning: ‘ASN1_STRING_data’ is deprecated [-Wdeprecated-declarations]
1925 | BIO_write(bio, ASN1_STRING_data(as),
| ^~~~~~~~~
In file included from /usr/include/openssl/evp.h:13,
from /usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:44:
/usr/include/openssl/asn1.h:554:1: note: declared here
554 | DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x))
| ^~~~~~~~~~~~~~~~~~
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:1931:6: warning: ‘ASN1_STRING_data’ is deprecated [-Wdeprecated-declarations]
1931 | BIO_write(bio, ASN1_STRING_data(as),
| ^~~~~~~~~
In file included from /usr/include/openssl/evp.h:13,
from /usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:44:
/usr/include/openssl/asn1.h:554:1: note: declared here
554 | DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x))
| ^~~~~~~~~~~~~~~~~~
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:1937:6: warning: ‘ASN1_STRING_data’ is deprecated [-Wdeprecated-declarations]
1937 | BIO_write(bio, ASN1_STRING_data(as),
| ^~~~~~~~~
In file included from /usr/include/openssl/evp.h:13,
from /usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:44:
/usr/include/openssl/asn1.h:554:1: note: declared here
554 | DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x))
| ^~~~~~~~~~~~~~~~~~
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c: In function ‘zif_openssl_x509_parse’:
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:1982:10: error: dereferencing pointer to incomplete type ‘X509’ {aka ‘struct x509_st’}
1982 | if (cert->name) {
| ^~
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c: In function ‘php_openssl_generate_private_key’:
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:3420:5: warning: ‘RSA_generate_key’ is deprecated [-Wdeprecated-declarations]
3420 | if (EVP_PKEY_assign_RSA(req->priv_key, RSA_generate_key(req->priv_key_bits, 0x10001, NULL, NULL))) {
| ^~
In file included from /usr/include/openssl/evp.h:13,
from /usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:44:
/usr/include/openssl/rsa.h:235:1: note: declared here
235 | DEPRECATEDIN_0_9_8(RSA *RSA_generate_key(int bits, unsigned long e, void
| ^~~~~~~~~~~~~~~~~~
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:3428:6: warning: ‘DSA_generate_parameters’ is deprecated [-Wdeprecated-declarations]
3428 | DSA *dsapar = DSA_generate_parameters(req->priv_key_bits, NULL, 0, NULL, NULL, NULL, NULL);
| ^~~
In file included from /usr/include/openssl/evp.h:13,
from /usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:44:
/usr/include/openssl/dsa.h:117:1: note: declared here
117 | DEPRECATEDIN_0_9_8(DSA *DSA_generate_parameters(int bits,
| ^~~~~~~~~~~~~~~~~~
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:3446:6: warning: ‘DH_generate_parameters’ is deprecated [-Wdeprecated-declarations]
3446 | DH *dhpar = DH_generate_parameters(req->priv_key_bits, 2, NULL, NULL);
| ^~
In file included from /usr/include/openssl/evp.h:13,
from /usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:44:
/usr/include/openssl/dh.h:139:1: note: declared here
139 | DEPRECATEDIN_0_9_8(DH *DH_generate_parameters(int prime_len, int generator,
| ^~~~~~~~~~~~~~~~~~
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c: In function ‘php_openssl_is_private_key’:
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:3485:14: error: dereferencing pointer to incomplete type ‘EVP_PKEY’ {aka ‘struct evp_pkey_st’}
3485 | switch (pkey->type) {
| ^~
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c: In function ‘php_openssl_pkey_init_dsa’:
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:3557:10: error: dereferencing pointer to incomplete type ‘DSA’ {aka ‘struct dsa_st’}
3557 | if (!dsa->p || !dsa->q || !dsa->g) {
| ^~
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c: In function ‘php_openssl_pkey_init_dh’:
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:3580:9: error: dereferencing pointer to incomplete type ‘DH’ {aka ‘struct dh_st’}
3580 | if (!dh->p || !dh->g) {
| ^~
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c: In function ‘zif_openssl_pkey_new’:
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:3548:9: error: dereferencing pointer to incomplete type ‘RSA’ {aka ‘struct rsa_st’}
3548 | _type->_name = BN_bin2bn( \
| ^~
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:3617:6: note: in expansion of macro ‘OPENSSL_PKEY_SET_BN’
3617 | OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), rsa, n);
| ^~~~~~~~~~~~~~~~~~~
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c: In function ‘zif_openssl_sign’:
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:4801:13: error: storage size of ‘md_ctx’ isn’t known
4801 | EVP_MD_CTX md_ctx;
| ^~~~~~
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:4845:2: warning: implicit declaration of function ‘EVP_MD_CTX_cleanup’; did you mean ‘EVP_MD_CTX_create’? [-Wimplicit-function-declaration]
4845 | EVP_MD_CTX_cleanup(&md_ctx);
| ^~~~~~~~~~~~~~~~~~
| EVP_MD_CTX_create
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c: In function ‘zif_openssl_verify’:
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:4859:17: error: storage size of ‘md_ctx’ isn’t known
4859 | EVP_MD_CTX md_ctx;
| ^~~~~~
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c: In function ‘zif_openssl_seal’:
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:4920:17: error: storage size of ‘ctx’ isn’t known
4920 | EVP_CIPHER_CTX ctx;
| ^~~
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c: In function ‘zif_openssl_open’:
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:5048:17: error: storage size of ‘ctx’ isn’t known
5048 | EVP_CIPHER_CTX ctx;
| ^~~
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c: In function ‘zif_openssl_digest’:
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:5154:13: error: storage size of ‘md_ctx’ isn’t known
5154 | EVP_MD_CTX md_ctx;
| ^~~~~~
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c: In function ‘zif_openssl_encrypt’:
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:5233:17: error: storage size of ‘cipher_ctx’ isn’t known
5233 | EVP_CIPHER_CTX cipher_ctx;
| ^~~~~~~~~~
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c: In function ‘zif_openssl_decrypt’:
/usr/local/lsws/phpbuild/php-5.6.40/ext/openssl/openssl.c:5316:17: error: storage size of ‘cipher_ctx’ isn’t known
5316 | EVP_CIPHER_CTX cipher_ctx;
| ^~~~~~~~~~
make: *** [Makefile:550: ext/openssl/openssl.lo] Error 1

After searching forums attempted using the steps in the below link and had not success
https://forum.openlitespeed.org/threads/ols-php-5-6-wont-compile-with-openssl.4520/
https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:php:apt

Any assistance is mostly appriciated.
 

Cold-Egg

Administrator
#2
Hi @chanaka_cmd
PHP5 cannot build with newer OpenSSL libraries, specifically the ones in Ubuntu 18+ that come by default. PHP says they will not support newer OpenSSL versions for PHP5.x.
 
#3
Thank you @Cold-Egg . Not the best solution as PHP5 seems to have a lot of vulnerabilities. How ever are are attempting to compile an older version of openSSL on Ubuntu 20.04 and use it to compile PHP5 as the application has a dependancy on PHP5.
 
Top