0

I would like to use multiple flags for mysqli_real_connect options. That is MYSQLI_CLIENT_COMPRESS and MYSQLI_CLIENT_SSL.

Tried passing the flags as an array as well as comma separated string. Both fail.

Here is how I am connecting, with MYSQLI_CLIENT_SSL flag:

$ssl->init();
if(!$ssl){die('Failed to initialise mysqli');}

$ssl->ssl_set(NULL,NULL,NULL,"c:\\inetpub\\wwwroot\\path_to_ca_certificates_folder","DHE-RSA-AES256-SHA") or die('Failed to set SSL');

$ssl->options(MYSQLI_OPT_CONNECT_TIMEOUT,5) or die('Setting MYSQLI_OPT_CONNECT_TIMEOUT failed');

if(!$ssl->real_connect('host.url','username','password','dbname',3306,NULL,MYSQLI_CLIENT_SSL)){
    die('Real connect failed: '.$ssl->connect_error);
}else{
    #do whatever
}
$ssl->close();

How do I ensure the connection is over SSL as well as the response is compressed?

Martin
  • 22,212
  • 11
  • 70
  • 132
jiddu
  • 1
  • 3
  • Thanks CBroe. $ssl->real_connect('host.url','username','password','dbname',3306,NULL,MYSQLI_CLIENT_SSL|MYSQLI_CLIENT_COMPRESS) That Pipe delimited flags seems to work. It does not throw any exceptions. However, wonder if there is a way to actually verify response is using compression? – jiddu Sep 13 '17 at 08:58
  • Dunno, I guess you could use something like Wireshark to try and see what data gets send between the database and the web server ... – CBroe Sep 13 '17 at 12:05
  • Cheers @CBroae, Will give that a try. – jiddu Sep 14 '17 at 09:34

0 Answers0