0

I am getting this error while trying to connect mysql on SSL.

Warning: mysqli_real_connect() [function.mysqli-real-connect]: SSL operation failed with code 1. OpenSSL Error messages: error:14082174:SSL routines:SSL3_CHECK_CERT_AND_ALGORITHM:dh key too small in /usr/www/test/testing.php on line 13

This works fine on my local wamp or xampp but not on the hosting web server

What can be done to solve this ? Any help will be appreciated.

After Notes -

I was originally using

$db->ssl_set('client-key.pem', 'client-cert.pem', 'ca-cert.pem', NULL, 'NULL');

and it used to work fine for years but only after we upgraded to different SSL certs it stopped working.

It should be what Mel_T just answered..

2
  • stackoverflow.com/questions/30701397/… might be helpful Commented Jul 6, 2015 at 14:46
  • I read that post but it did not help why local server would work okay. This connection would work okay some time back but started showing this error recently. Commented Jul 6, 2015 at 14:56

1 Answer 1

2

You have to put a cipher in your mysqli connection, see http://php.net/manual/de/mysqli.ssl-set.php

$db = mysqli_init(); 
mysqli_options($db, MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, true);

$db->ssl_set('/etc/mysql/certs/client-key.pem', '/etc/mysql/certs/client-cert.pem', '/etc/mysql/certs/ca-cert.pem', NULL, 'CAMELLIA128-SHA'); 
$link = mysqli_real_connect ($db, 'host', 'user', 'password', 'mysql', 'port', NULL, MYSQLI_CLIENT_SSL);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.