Skip to content

Problem in SSL connection through PDOΒ #12

@skverma618

Description

@skverma618

I tried connecting my local codebase with the remote database through PDO but its not working, after that I made some changes in core.php and created a function using mysqli, and now the connection is working.

I used the same connection variables and pem files for verification

inside connect function in core.php

I also tried directly writing the PDO code as follows:

           $clientCertPath = $_SERVER['DOCUMENT_ROOT'] . "/client-cert.pem";
            $clientKeyPath = $_SERVER['DOCUMENT_ROOT'] . "/client-key.pem";
            $caCertPath = $_SERVER['DOCUMENT_ROOT'] . "/server-ca.pem";

            // PDO Connection options for SSL
            $pdoOptions = array(
                \PDO::MYSQL_ATTR_SSL_CA => $caCertPath,
                \PDO::MYSQL_ATTR_SSL_KEY => $clientKeyPath,
                \PDO::MYSQL_ATTR_SSL_CERT => $clientCertPath,
                \PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false,
            );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    To do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions