Example when build PHP 7.4 from source with OpenSSL on Ubuntu 22.04, we see many error:
1056 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *prv); | ^~~~~~~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4516:49: warning: ‘EC_POINT_set_affine_coordinates_GFp’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4516 | if (!EC_POINT_set_affine_coordinates_GFp( | ^~ In file included from /usr/include/openssl/x509.h:33, from /root/php-src/ext/openssl/openssl.c:49: /usr/include/openssl/ec.h:646:27: note: declared here 646 | OSSL_DEPRECATEDIN_3_0 int EC_POINT_set_affine_coordinates_GFp | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4525:49: warning: ‘EC_KEY_set_public_key’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4525 | if (!EC_KEY_set_public_key(eckey, pnt)) { | ^~ In file included from /usr/include/openssl/x509.h:33, from /root/php-src/ext/openssl/openssl.c:49: /usr/include/openssl/ec.h:1070:27: note: declared here 1070 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub); | ^~~~~~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4533:41: warning: ‘EC_KEY_check_key’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4533 | if (!EC_KEY_check_key(eckey)) { | ^~ In file included from /usr/include/openssl/x509.h:33, from /root/php-src/ext/openssl/openssl.c:49: /usr/include/openssl/ec.h:1107:27: note: declared here 1107 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_check_key(const EC_KEY *key); | ^~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4535:49: warning: ‘EC_KEY_generate_key’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4535 | EC_KEY_generate_key(eckey); | ^~~~~~~~~~~~~~~~~~~ In file included from /usr/include/openssl/x509.h:33, from /root/php-src/ext/openssl/openssl.c:49: /usr/include/openssl/ec.h:1101:27: note: declared here 1101 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_generate_key(EC_KEY *key); | ^~~~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4538:41: warning: ‘EC_KEY_check_key’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4538 | if (EC_KEY_check_key(eckey) && EVP_PKEY_assign_EC_KEY(pkey, eckey)) { | ^~ In file included from /usr/include/openssl/x509.h:33, from /root/php-src/ext/openssl/openssl.c:49: /usr/include/openssl/ec.h:1107:27: note: declared here 1107 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_check_key(const EC_KEY *key); | ^~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4538:41: warning: ‘EVP_PKEY_assign’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4538 | if (EC_KEY_check_key(eckey) && EVP_PKEY_assign_EC_KEY(pkey, eckey)) { | ^~ In file included from /root/php-src/ext/openssl/openssl.c:44: /usr/include/openssl/evp.h:1328:5: note: declared here 1328 | int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key); | ^~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4561:33: warning: ‘EC_KEY_free’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4561 | EC_KEY_free(eckey); | ^~~~~~~~~~~ In file included from /usr/include/openssl/x509.h:33, from /root/php-src/ext/openssl/openssl.c:49: /usr/include/openssl/ec.h:1003:28: note: declared here 1003 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_free(EC_KEY *key); | ^~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c: In function ‘zif_openssl_pkey_export_to_file’: /root/php-src/ext/openssl/openssl.c:4640:33: warning: ‘PEM_write_bio_ECPrivateKey’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4640 | pem_write = PEM_write_bio_ECPrivateKey( | ^~~~~~~~~ In file included from /root/php-src/ext/openssl/openssl.c:52: /usr/include/openssl/pem.h:462:1: note: declared here 462 | DECLARE_PEM_rw_cb_attr(OSSL_DEPRECATEDIN_3_0, ECPrivateKey, EC_KEY) | ^~~~~~~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4641:49: warning: ‘EVP_PKEY_get0_EC_KEY’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4641 | bio_out, EVP_PKEY_get0_EC_KEY(key), cipher, | ^~~~~~~ In file included from /root/php-src/ext/openssl/openssl.c:44: /usr/include/openssl/evp.h:1372:25: note: declared here 1372 | const struct ec_key_st *EVP_PKEY_get0_EC_KEY(const EVP_PKEY *pkey); | ^~~~~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c: In function ‘zif_openssl_pkey_export’: /root/php-src/ext/openssl/openssl.c:4717:33: warning: ‘PEM_write_bio_ECPrivateKey’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4717 | pem_write = PEM_write_bio_ECPrivateKey( | ^~~~~~~~~ In file included from /root/php-src/ext/openssl/openssl.c:52: /usr/include/openssl/pem.h:462:1: note: declared here 462 | DECLARE_PEM_rw_cb_attr(OSSL_DEPRECATEDIN_3_0, ECPrivateKey, EC_KEY) | ^~~~~~~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4718:49: warning: ‘EVP_PKEY_get0_EC_KEY’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4718 | bio_out, EVP_PKEY_get0_EC_KEY(key), cipher, | ^~~~~~~ In file included from /root/php-src/ext/openssl/openssl.c:44: /usr/include/openssl/evp.h:1372:25: note: declared here 1372 | const struct ec_key_st *EVP_PKEY_get0_EC_KEY(const EVP_PKEY *pkey); | ^~~~~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c: In function ‘zif_openssl_pkey_get_details’: /root/php-src/ext/openssl/openssl.c:4850:33: warning: ‘EVP_PKEY_get0_RSA’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4850 | RSA *rsa = EVP_PKEY_get0_RSA(pkey); | ^~~ In file included from /root/php-src/ext/openssl/openssl.c:44: /usr/include/openssl/evp.h:1346:22: note: declared here 1346 | const struct rsa_st *EVP_PKEY_get0_RSA(const EVP_PKEY *pkey); | ^~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4850:44: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 4850 | RSA *rsa = EVP_PKEY_get0_RSA(pkey); | ^~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4857:41: warning: ‘RSA_get0_key’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4857 | RSA_get0_key(rsa, &n, &e, &d); | ^~~~~~~~~~~~ In file included from /root/php-src/ext/openssl/openssl.c:46: /usr/include/openssl/rsa.h:222:28: note: declared here 222 | OSSL_DEPRECATEDIN_3_0 void RSA_get0_key(const RSA *r, | ^~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4858:41: warning: ‘RSA_get0_factors’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4858 | RSA_get0_factors(rsa, &p, &q); | ^~~~~~~~~~~~~~~~ In file included from /root/php-src/ext/openssl/openssl.c:46: /usr/include/openssl/rsa.h:225:28: note: declared here 225 | OSSL_DEPRECATEDIN_3_0 void RSA_get0_factors(const RSA *r, | ^~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4859:41: warning: ‘RSA_get0_crt_params’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4859 | RSA_get0_crt_params(rsa, &dmp1, &dmq1, &iqmp); | ^~~~~~~~~~~~~~~~~~~ In file included from /root/php-src/ext/openssl/openssl.c:46: /usr/include/openssl/rsa.h:230:28: note: declared here 230 | OSSL_DEPRECATEDIN_3_0 void RSA_get0_crt_params(const RSA *r, | ^~~~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4879:33: warning: ‘EVP_PKEY_get0_DSA’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4879 | DSA *dsa = EVP_PKEY_get0_DSA(pkey); | ^~~ In file included from /root/php-src/ext/openssl/openssl.c:44: /usr/include/openssl/evp.h:1355:22: note: declared here 1355 | const struct dsa_st *EVP_PKEY_get0_DSA(const EVP_PKEY *pkey); | ^~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4879:44: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 4879 | DSA *dsa = EVP_PKEY_get0_DSA(pkey); | ^~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4886:41: warning: ‘DSA_get0_pqg’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4886 | DSA_get0_pqg(dsa, &p, &q, &g); | ^~~~~~~~~~~~ In file included from /root/php-src/ext/openssl/openssl.c:47: /usr/include/openssl/dsa.h:201:28: note: declared here 201 | OSSL_DEPRECATEDIN_3_0 void DSA_get0_pqg(const DSA *d, const BIGNUM **p, | ^~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4887:41: warning: ‘DSA_get0_key’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4887 | DSA_get0_key(dsa, &pub_key, &priv_key); | ^~~~~~~~~~~~ In file included from /root/php-src/ext/openssl/openssl.c:47: /usr/include/openssl/dsa.h:204:28: note: declared here 204 | OSSL_DEPRECATEDIN_3_0 void DSA_get0_key(const DSA *d, const BIGNUM **pub_key, | ^~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4901:33: warning: ‘EVP_PKEY_get0_DH’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4901 | DH *dh = EVP_PKEY_get0_DH(pkey); | ^~ In file included from /root/php-src/ext/openssl/openssl.c:44: /usr/include/openssl/evp.h:1363:43: note: declared here 1363 | OSSL_DEPRECATEDIN_3_0 const struct dh_st *EVP_PKEY_get0_DH(const EVP_PKEY *pkey); | ^~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4901:42: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 4901 | DH *dh = EVP_PKEY_get0_DH(pkey); | ^~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4908:41: warning: ‘DH_get0_pqg’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4908 | DH_get0_pqg(dh, &p, &q, &g); | ^~~~~~~~~~~ In file included from /usr/include/openssl/dsa.h:51, from /root/php-src/ext/openssl/openssl.c:47: /usr/include/openssl/dh.h:257:28: note: declared here 257 | OSSL_DEPRECATEDIN_3_0 void DH_get0_pqg(const DH *dh, const BIGNUM **p, | ^~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4909:41: warning: ‘DH_get0_key’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4909 | DH_get0_key(dh, &pub_key, &priv_key); | ^~~~~~~~~~~ In file included from /usr/include/openssl/dsa.h:51, from /root/php-src/ext/openssl/openssl.c:47: /usr/include/openssl/dh.h:260:28: note: declared here 260 | OSSL_DEPRECATEDIN_3_0 void DH_get0_key(const DH *dh, const BIGNUM **pub_key, | ^~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4923:25: warning: ‘EVP_PKEY_get0_EC_KEY’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4923 | if (EVP_PKEY_get0_EC_KEY(pkey) != NULL) { | ^~ In file included from /root/php-src/ext/openssl/openssl.c:44: /usr/include/openssl/evp.h:1372:25: note: declared here 1372 | const struct ec_key_st *EVP_PKEY_get0_EC_KEY(const EVP_PKEY *pkey); | ^~~~~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4932:33: warning: ‘EVP_PKEY_get0_EC_KEY’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4932 | const EC_KEY *ec_key = EVP_PKEY_get0_EC_KEY(pkey); | ^~~~~ In file included from /root/php-src/ext/openssl/openssl.c:44: /usr/include/openssl/evp.h:1372:25: note: declared here 1372 | const struct ec_key_st *EVP_PKEY_get0_EC_KEY(const EVP_PKEY *pkey); | ^~~~~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4937:33: warning: ‘EC_KEY_get0_group’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4937 | ec_group = EC_KEY_get0_group(ec_key); | ^~~~~~~~ In file included from /usr/include/openssl/x509.h:33, from /root/php-src/ext/openssl/openssl.c:49: /usr/include/openssl/ec.h:1034:39: note: declared here 1034 | OSSL_DEPRECATEDIN_3_0 const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key); | ^~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4959:33: warning: ‘EC_KEY_get0_public_key’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4959 | pub = EC_KEY_get0_public_key(ec_key); | ^~~ In file included from /usr/include/openssl/x509.h:33, from /root/php-src/ext/openssl/openssl.c:49: /usr/include/openssl/ec.h:1062:39: note: declared here 1062 | OSSL_DEPRECATEDIN_3_0 const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key); | ^~~~~~~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4961:33: warning: ‘EC_POINT_get_affine_coordinates_GFp’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4961 | if (EC_POINT_get_affine_coordinates_GFp(ec_group, pub, x, y, NULL)) { | ^~ In file included from /usr/include/openssl/x509.h:33, from /root/php-src/ext/openssl/openssl.c:49: /usr/include/openssl/ec.h:659:27: note: declared here 659 | OSSL_DEPRECATEDIN_3_0 int EC_POINT_get_affine_coordinates_GFp | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4968:33: warning: ‘EC_KEY_get0_private_key’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4968 | if ((d = EC_KEY_get0_private_key(EVP_PKEY_get0_EC_KEY(pkey))) != NULL) { | ^~ In file included from /usr/include/openssl/x509.h:33, from /root/php-src/ext/openssl/openssl.c:49: /usr/include/openssl/ec.h:1048:37: note: declared here 1048 | OSSL_DEPRECATEDIN_3_0 const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *key); | ^~~~~~~~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:4968:33: warning: ‘EVP_PKEY_get0_EC_KEY’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 4968 | if ((d = EC_KEY_get0_private_key(EVP_PKEY_get0_EC_KEY(pkey))) != NULL) { | ^~ In file included from /root/php-src/ext/openssl/openssl.c:44: /usr/include/openssl/evp.h:1372:25: note: declared here 1372 | const struct ec_key_st *EVP_PKEY_get0_EC_KEY(const EVP_PKEY *pkey); | ^~~~~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c: In function ‘zif_openssl_dh_compute_key’: /root/php-src/ext/openssl/openssl.c:5011:9: warning: ‘EVP_PKEY_get0_DH’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 5011 | dh = EVP_PKEY_get0_DH(pkey); | ^~ In file included from /root/php-src/ext/openssl/openssl.c:44: /usr/include/openssl/evp.h:1363:43: note: declared here 1363 | OSSL_DEPRECATEDIN_3_0 const struct dh_st *EVP_PKEY_get0_DH(const EVP_PKEY *pkey); | ^~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:5011:12: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 5011 | dh = EVP_PKEY_get0_DH(pkey); | ^ /root/php-src/ext/openssl/openssl.c:5019:9: warning: ‘DH_size’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 5019 | data = zend_string_alloc(DH_size(dh), 0); | ^~~~ In file included from /usr/include/openssl/dsa.h:51, from /root/php-src/ext/openssl/openssl.c:47: /usr/include/openssl/dh.h:207:27: note: declared here 207 | OSSL_DEPRECATEDIN_3_0 int DH_size(const DH *dh); | ^~~~~~~ /root/php-src/ext/openssl/openssl.c:5020:9: warning: ‘DH_compute_key’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 5020 | len = DH_compute_key((unsigned char*)ZSTR_VAL(data), pub, dh); | ^~~ In file included from /usr/include/openssl/dsa.h:51, from /root/php-src/ext/openssl/openssl.c:47: /usr/include/openssl/dh.h:228:27: note: declared here 228 | OSSL_DEPRECATEDIN_3_0 int DH_compute_key(unsigned char *key, | ^~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c: In function ‘zif_openssl_private_encrypt’: /root/php-src/ext/openssl/openssl.c:5764:25: warning: ‘RSA_private_encrypt’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 5764 | successful = (RSA_private_encrypt((int)data_len, | ^~~~~~~~~~ In file included from /root/php-src/ext/openssl/openssl.c:46: /usr/include/openssl/rsa.h:290:5: note: declared here 290 | int RSA_private_encrypt(int flen, const unsigned char *from, unsigned char *to, | ^~~~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:5767:49: warning: ‘EVP_PKEY_get0_RSA’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 5767 | EVP_PKEY_get0_RSA(pkey), | ^~~~~~~~~~~~~~~~~ In file included from /root/php-src/ext/openssl/openssl.c:44: /usr/include/openssl/evp.h:1346:22: note: declared here 1346 | const struct rsa_st *EVP_PKEY_get0_RSA(const EVP_PKEY *pkey); | ^~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:5767:49: warning: passing argument 4 of ‘RSA_private_encrypt’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 5767 | EVP_PKEY_get0_RSA(pkey), | ^~~~~~~~~~~~~~~~~~~~~~~ In file included from /root/php-src/ext/openssl/openssl.c:46: /usr/include/openssl/rsa.h:291:30: note: expected ‘RSA *’ {aka ‘struct rsa_st *’} but argument is of type ‘const struct rsa_st *’ 291 | RSA *rsa, int padding); | ~~~~~^~~ /root/php-src/ext/openssl/openssl.c: In function ‘zif_openssl_private_decrypt’: /root/php-src/ext/openssl/openssl.c:5825:25: warning: ‘RSA_private_decrypt’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 5825 | cryptedlen = RSA_private_decrypt((int)data_len, | ^~~~~~~~~~ In file included from /root/php-src/ext/openssl/openssl.c:46: /usr/include/openssl/rsa.h:296:5: note: declared here 296 | int RSA_private_decrypt(int flen, const unsigned char *from, unsigned char *to, | ^~~~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:5828:41: warning: ‘EVP_PKEY_get0_RSA’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 5828 | EVP_PKEY_get0_RSA(pkey), | ^~~~~~~~~~~~~~~~~ In file included from /root/php-src/ext/openssl/openssl.c:44: /usr/include/openssl/evp.h:1346:22: note: declared here 1346 | const struct rsa_st *EVP_PKEY_get0_RSA(const EVP_PKEY *pkey); | ^~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:5828:41: warning: passing argument 4 of ‘RSA_private_decrypt’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 5828 | EVP_PKEY_get0_RSA(pkey), | ^~~~~~~~~~~~~~~~~~~~~~~ In file included from /root/php-src/ext/openssl/openssl.c:46: /usr/include/openssl/rsa.h:297:30: note: expected ‘RSA *’ {aka ‘struct rsa_st *’} but argument is of type ‘const struct rsa_st *’ 297 | RSA *rsa, int padding); | ~~~~~^~~ /root/php-src/ext/openssl/openssl.c: In function ‘zif_openssl_public_encrypt’: /root/php-src/ext/openssl/openssl.c:5892:25: warning: ‘RSA_public_encrypt’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 5892 | successful = (RSA_public_encrypt((int)data_len, | ^~~~~~~~~~ In file included from /root/php-src/ext/openssl/openssl.c:46: /usr/include/openssl/rsa.h:287:5: note: declared here 287 | int RSA_public_encrypt(int flen, const unsigned char *from, unsigned char *to, | ^~~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:5895:49: warning: ‘EVP_PKEY_get0_RSA’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 5895 | EVP_PKEY_get0_RSA(pkey), | ^~~~~~~~~~~~~~~~~ In file included from /root/php-src/ext/openssl/openssl.c:44: /usr/include/openssl/evp.h:1346:22: note: declared here 1346 | const struct rsa_st *EVP_PKEY_get0_RSA(const EVP_PKEY *pkey); | ^~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:5895:49: warning: passing argument 4 of ‘RSA_public_encrypt’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 5895 | EVP_PKEY_get0_RSA(pkey), | ^~~~~~~~~~~~~~~~~~~~~~~ In file included from /root/php-src/ext/openssl/openssl.c:46: /usr/include/openssl/rsa.h:288:29: note: expected ‘RSA *’ {aka ‘struct rsa_st *’} but argument is of type ‘const struct rsa_st *’ 288 | RSA *rsa, int padding); | ~~~~~^~~ /root/php-src/ext/openssl/openssl.c: In function ‘zif_openssl_public_decrypt’: /root/php-src/ext/openssl/openssl.c:5954:25: warning: ‘RSA_public_decrypt’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 5954 | cryptedlen = RSA_public_decrypt((int)data_len, | ^~~~~~~~~~ In file included from /root/php-src/ext/openssl/openssl.c:46: /usr/include/openssl/rsa.h:293:5: note: declared here 293 | int RSA_public_decrypt(int flen, const unsigned char *from, unsigned char *to, | ^~~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:5957:41: warning: ‘EVP_PKEY_get0_RSA’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 5957 | EVP_PKEY_get0_RSA(pkey), | ^~~~~~~~~~~~~~~~~ In file included from /root/php-src/ext/openssl/openssl.c:44: /usr/include/openssl/evp.h:1346:22: note: declared here 1346 | const struct rsa_st *EVP_PKEY_get0_RSA(const EVP_PKEY *pkey); | ^~~~~~~~~~~~~~~~~ /root/php-src/ext/openssl/openssl.c:5957:41: warning: passing argument 4 of ‘RSA_public_decrypt’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 5957 | EVP_PKEY_get0_RSA(pkey), | ^~~~~~~~~~~~~~~~~~~~~~~ In file included from /root/php-src/ext/openssl/openssl.c:46: /usr/include/openssl/rsa.h:294:29: note: expected ‘RSA *’ {aka ‘struct rsa_st *’} but argument is of type ‘const struct rsa_st *’ 294 | RSA *rsa, int padding); | ~~~~~^~~ make: *** [Makefile:600: ext/openssl/openssl.lo] Error 1
The problem is about the OpenSSL
and libssl
versions are changed since Ubuntu 22.04
is released.
By default, it includes the OpenSSL 3
and libssl3
in Ubuntu 22.04
. But compiling the PHP 7.4
version needs to use the libssl1.1
when compiling the openssl
extension.
To resolve the above issue, it should compile the openssl1.1
from source in Ubuntu 22.04
and setting the PKG_CONFIG_PATH
environment variable to specify the openssl1.1
path.
Step 1: Remove openSSL 3.0
root@tutorialspots ~ # apt remove openssl Reading package lists... Done Building dependency tree... Done Reading state information... Done The following packages were automatically installed and are no longer required: apache2-data apache2-utils apport-symptoms bc gir1.2-packagekitglib-1.0 libappstream4 libglib2.0-bin libgstreamer1.0-0 libpackagekit-glib2-18 libstemmer0d libxmlb2 packagekit python3-attr python3-automat python3-bcrypt python3-blinker python3-cffi-backend python3-chardet python3-configobj python3-constantly python3-cryptography python3-debconf python3-debian python3-distupgrade python3-hamcrest python3-hyperlink python3-idna python3-incremental python3-jeepney python3-jwt python3-keyring python3-lazr.uri python3-oauthlib python3-openssl python3-problem-report python3-pyasn1 python3-pyasn1-modules python3-pyparsing dpkg: warning: while removing update-manager-core, directory '/var/lib/update-manager' not empty so not removed Removing ubuntu-release-upgrader-core (1:22.04.19) ... Removing software-properties-common (0.99.22.9) ... Removing landscape-common (19.12-0ubuntu13) ... Removing ssl-cert (1.1.2) ... Removing python3-apport (2.20.11-0ubuntu82.5) ... Removing python3-software-properties (0.99.22.9) ... Removing python3-launchpadlib (1.10.16-1) ... Removing python3-lazr.restfulclient (0.14.4-1) ... Removing python3-httplib2 (0.20.2-2) ... Removing ssh-import-id (5.11-0ubuntu1) ... Removing ca-certificates (20230311ubuntu0.22.04.1) ... Removing dangling symlinks from /etc/ssl/certs... done. Removing openssl (3.0.2-0ubuntu1.15) ... (Reading database ... 73549 files and directories currently installed.) Preparing to unpack .../python3-update-manager_1%3a22.04.20_all.deb ... Unpacking python3-update-manager (1:22.04.20) over (1:22.04.18) ... Setting up python3-update-manager (1:22.04.20) ... Processing triggers for man-db (2.10.2-1) ... Processing triggers for dbus (1.12.20-2ubuntu4.1) ... Processing triggers for hicolor-icon-theme (0.17-2) ... Scanning processes... Scanning candidates... Scanning processor microcode... Scanning linux images... The processor microcode seems to be up-to-date. Restarting services... systemctl restart supervisor.service Service restarts being deferred: /etc/needrestart/restart.d/dbus.service systemctl restart getty@tty1.service systemctl restart networkd-dispatcher.service systemctl restart systemd-logind.service systemctl restart unattended-upgrades.service No containers need to be restarted. No user sessions are running outdated binaries. No VM guests are running outdated hypervisor (qemu) binaries on this host.
Step 2: install OpenSSL 1.1 from source
wget --no-check-certificate https://www.openssl.org/source/openssl-1.1.1i.tar.gz tar xzf openssl-1.1.1i.tar.gz cd openssl-1.1.1i ./Configure --prefix=/root/openssl-1.1.1i/bin -fPIC -shared linux-x86_64 make -j 4 make install
result:
root@tutorialspots ~ # wget --no-check-certificate https://www.openssl.org/source/openssl-1.1.1i.tar.gz --2024-06-22 10:51:18-- https://www.openssl.org/source/openssl-1.1.1i.tar.gz Resolving www.openssl.org (www.openssl.org)... 2600:1901:0:1812::, 34.36.58.177 Connecting to www.openssl.org (www.openssl.org)|2600:1901:0:1812::|:443... connected. WARNING: cannot verify www.openssl.org's certificate, issued by ‘CN=R3,O=Let's Encrypt,C=US’: Unable to locally verify the issuer's authority. HTTP request sent, awaiting response... 200 OK Length: 9808346 (9.4M) [application/tar+gzip] Saving to: ‘openssl-1.1.1i.tar.gz’ openssl-1.1.1i.tar. 100%[===================>] 9.35M --.-KB/s in 0.1s 2024-06-22 10:51:18 (71.6 MB/s) - ‘openssl-1.1.1i.tar.gz’ saved [9808346/9808346] ... root@tutorialspots ~/openssl-1.1.1i # ./Configure --prefix=/root/openssl-1.1.1i/bin -fPIC -shared linux-x86_64 Configuring OpenSSL version 1.1.1i (0x1010109fL) for linux-x86_64 Using os-specific seed configuration Creating configdata.pm Creating Makefile ********************************************************************** *** *** *** OpenSSL has been successfully configured *** *** *** *** If you encounter a problem while building, please open an *** *** issue on GitHub <https://github.com/openssl/openssl/issues> *** *** and include the output from the following command: *** *** *** *** perl configdata.pm --dump *** *** *** *** (If you are new to OpenSSL, you might want to consult the *** *** 'Troubleshooting' section in the INSTALL file first) *** *** *** **********************************************************************
Step 3: setting the PKG_CONFIG_PATH
environment variable
export PKG_CONFIG_PATH=/root/openssl-1.1.1i/bin/lib/pkgconfig ./configure --with-openssl --enable-opcache make make install
done!