PHP: PDO(MySQL) SSL Connection -
i trying establish ssl connection mysql server using following code (on debian gnu/linux 7 (wheezy) php 5.4.4):
$db = new pdo('mysql:host=mysql.myorganization.net;dbname=mydb', 'username', 'password', array( pdo::mysql_attr_ssl_ca => 'mysqlcertificates/cachain.pem' )); var_dump($db->query("show status 'ssl_cipher';")->fetchall());
but getting error:
sqlstate[hy000] [2026] ssl connection error: asn: bad other signature confirmation
i can establish ssl connection using mysql command:
mysql -u username -p -h mysql.myorganizataion.net --ssl-ca mysqlcertificates/cachain.pem
i built php 5.4.4 source , (without running make install) ran
sapi/cli/php ~/projects/test.php
and following output
array(1) { [0]=> array(4) { ["variable_name"]=> string(10) "ssl_cipher" [0]=> string(10) "ssl_cipher" ["value"]=> string(18) "dhe-rsa-aes256-sha" [1]=> string(18) "dhe-rsa-aes256-sha" } }
i tried looking in php.ini files , my.cnf files see if might upsetting connection not sure looking for.
so question is:
what causing error show when php run /usr/bin/php not when run sapi/cli/php in build folder?
i realize php out of date unable update until our next maintenance window, , feel have done far demonstrates not version issue.
in example not using full path in pdo connection string certificate:
pdo::mysql_attr_ssl_ca => 'mysqlcertificates/cachain.pem'
could try full path below
pdo::mysql_attr_ssl_ca => '/fullpath/to/mysqlcertificates/cachain.pem'
Comments
Post a Comment