PDO SSL connection error

I am getting the following error when trying to connect from my Windows box to my Linux box:

Warning: PDO::__construct(): SSL operation failed with code 1. OpenSSL Error messages: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number

      

This is the connection code:

    $dbE = new PDO(
                    'mysql:dbname=db_name;host=host_ip;',
                    'username',
                    'password',
                    array(                                                                                     
                            PDO::MYSQL_ATTR_SSL_KEY         =>'client_side_path\client-key.pem',
                            PDO::MYSQL_ATTR_SSL_CERT        =>'client_side_path\client-cert.pem',
                            PDO::MYSQL_ATTR_SSL_CA          =>'client_side_path\ca-cert.pem'
                    )                                  
                   );
    $dbE->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

    echo 'Connected';  

      

Any ideas are appreciated.

+3


source to share


1 answer


Fixed. The reason was that the path on Server B to the CA was not correct. It's worth noting that in order to fix this, I tried a connection outside of PHP directly from Server A, and it got a "bad other signature confirmation" error - I then downloaded the CA certificate and found it empty. Reboot the server, set the correct paths in both my.cnf and the server start call and everything is fixed. It is really worth trying a direct mysql connection as it gave a completely different error that was much more useful than PDO.



+1


source







All Articles