Skip to content
This repository has been archived by the owner on Mar 27, 2020. It is now read-only.

how to use ssl #7

Closed
Skeyelab opened this issue Apr 29, 2014 · 1 comment
Closed

how to use ssl #7

Skeyelab opened this issue Apr 29, 2014 · 1 comment
Labels

Comments

@Skeyelab
Copy link

I need to use SSL certs/keys to connect to a mysql cluster for a project I am working on. I already have the project completed using DB-MySQL. How can I use this method:
http://www.php.net/manual/en/mysqli.ssl-set.php

Thanks

@jasny jasny added the question label Apr 29, 2014
@jasny
Copy link
Owner

jasny commented Apr 29, 2014

You should overwrite the constructor and call $this->ssl_set() before calling the parent constructor.

class DB extends Jasny\MySQL\DB
{
    public function __construct($host, $username = null, $password = null, $dbname = null, $port = null, $ssl = null)
    {
        if (isset($ssl)) {
            $ssl = (object)$ssl;
            $this->ssl_set($ssl->key, $ssl->cert, $ssl->ca, $ssl->capath, $ssl->cipher);
        }

        parent::__construct($host, $username, $password, $dbname, $port);
    }
}

@jasny jasny closed this as completed Apr 29, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants