Bug #74943 [Opn->Nab]: PHP Mysql connection with SSL is not working PDO
| From: | nikic@php.net | Date: | Mon, 17 Jul 2017 19:43:22 +0000 |
| Subject: | Bug #74943 [Opn->Nab]: PHP Mysql connection with SSL is not working PDO | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-210099@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74943&edit=1
ID: 74943
Updated by: nikic@php.net
Reported by: rnkhouse at gmail dot com
Summary: PHP Mysql connection with SSL is not working PDO
-Status: Open
+Status: Not a bug
Type: Bug
Package: PDO related
Operating System: Ubuntu 16.04
PHP Version: 7.1.7
Block user comment: N
Private report: N
New Comment:
If you wish to disable peer verification, you can specify PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT
=> false.
Previous Comments:
------------------------------------------------------------------------
[2017-07-17 19:38:27] rnkhouse at gmail dot com
I have changed the server. But, host name is still the same.
https://stackoverflow.com/questions/45090905/php-mysql-connection-with-ssl-is-not-working-pdo
------------------------------------------------------------------------
[2017-07-17 19:31:58] spam2 at rhsoft dot net
in case of self signed certificates this is *not* a bug and you have should done your homework
because when you upgrade from 5.3 to 7.1 and changes between apply
http://php.net/manual/en/migration56.openssl.php
i googled that for you:
https://stackoverflow.com/questions/31424518/php-5-6-mysql-ssl-and-self-signed-certificates
https://stackoverflow.com/questions/34622899/pdo-with-self-signed-certificates
------------------------------------------------------------------------
[2017-07-17 19:28:55] rnkhouse at gmail dot com
version change
------------------------------------------------------------------------
[2017-07-17 19:26:27] rnkhouse at gmail dot com
Description:
------------
Mysql server is running php5.3. New webserver is running php7.1 (migrated from php5.3). When I try
to connect Mysql server with ssl its not working.
try {
$dbh = new PDO($dsn, $user, $password, array(PDO::MYSQL_ATTR_SSL_KEY =>
'/etc/mysql/client-key.pem',
PDO::MYSQL_ATTR_SSL_CERT =>
'/etc/mysql/client-cert.pem',
PDO::MYSQL_ATTR_SSL_CA =>
'/etc/mysql/ca-cert.pem')
);
echo "Connestion established";
} catch (PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
}
>Connection failed: SQLSTATE[HY000] [2002]
>PDO::__construct(): SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
But, When I remove SSL block from connection, its working fine. I don't know what's going
on. May be version mismatch of server and client. Becasue I am using old public key and private key.
Is it because of mysql client and server version mismatch?
PS: I have upgraded php7 in webserver only.
Actual result:
--------------
PDO::__construct(): SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74943&edit=1