Site icon Dipin Krishna

PHP Error:0607A082:digital envelope routines:EVP_CI PHER_CTX_set_key_length:invalid key length

php

If you are trying to use an older version of PHP to connect MYSQL over SSL, there is a good chance that you encounter the following errors:
error:0607A082:digital envelope routines:EVP_CI PHER_CTX_set_key_length:
error:0906D06C:PEM routines:PEM_read_bio:no start line

This is a bug in PHP, OpenSSL. This bug has been fixed in PHP version > 7.1.

In case you are stuck with the older version of PHP, here is a workaround:
You will need to add the following line before any prepare/query command.

openssl_error_string();

This will clear the previous OpenSSL error.
Usage Eg:

openssl_error_string();
$db->prepare('SELECT * from test');
openssl_error_string();
$db->query('SELECT * from test');

Hope this helps.

Exit mobile version