ZF-6140: Secure connection to mysql with Zend

Issue Type: Bug Created: 2009-03-27T07:39:47.000+0000 Last Updated: 2012-11-20T21:37:25.000+0000 Status: Open Fix version(s): Reporter: Unlimit Unlimitov (unlimit) Assignee: None Tags: - Zend_Db_Adapter_Mysqli

Related issues: Attachments: - documentation.diff


I need connect to mysql server that use secure(ssl) connection.

Mysqli have method to setup ssl - bool mysqli::ssl_set ( string $key , string $cert , string $ca , string $capath , string $cipher ).

With Zend I try use this code:

$dbAdapter=Zend_Db::factory($this->_config->production->database); $dbAdapter->getConnection()->ssl_set('client-key.pem', 'client-cert.pem', 'ca-cert.pem',NULL,NULL);

But Zend initiates the connection before ssl sertificates are set and I get mysql connection error.

How I can connect to remote mysql server with mysqli and Zend?


Posted by Carl Welch (cwelch) on 2010-06-03T13:33:37.000+0000

I would also like to see Zend Framework support SSL connections to MySQL. I've attached a patch which made it work for me. The following is a code sample (using the patched Zend_Db_Adapter_Mysqli):

$db_attr_ref = array( 'host' => '', 'username' => 'user', 'password' => 'pass', 'dbname' => 'db', 'driver_options' => array( 'realConnectFlags' => MYSQLI_CLIENT_SSL, 'sslCipher' => 'DHE-RSA-AES256-SHA', ), ); $dbh = Zend_Db::factory('Mysqli', $db_attr_ref);

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.