Found the answer, so I am turning this question into a suggestion.
In short, SSL to MySQL on a remote server won't work unless you add MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT to the connection in src/XF/Db/Mysqli/Adapter.php, as I have here:
My original question:
I am transitioning to a new server. As an intermediate step, I want to have the xenforo files on the new server and mysql still on the old server. I want to enable SSL, but it isn't working.
It works with:
I can connect to the server with mysql client from the new server:
I can connect with a basic mysqli php script.
But it doesn't work when enabled:
Mysql error on the old server:
Xenforo 2.2
MySQL5.7
PHP 8.3
Cheer! Hope this helps someone.
In short, SSL to MySQL on a remote server won't work unless you add MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT to the connection in src/XF/Db/Mysqli/Adapter.php, as I have here:
$isConnected = @$connection->real_connect(
$config['host'], $config['username'], $config['password'],
$config['dbname'], $config['port'] ?: 3306, $config['socket']
, MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT
);
My original question:
I am transitioning to a new server. As an intermediate step, I want to have the xenforo files on the new server and mysql still on the old server. I want to enable SSL, but it isn't working.
It works with:
$config['db']['ssl']['enabled'] = false;
I can connect to the server with mysql client from the new server:
mysql
--ssl-ca=/xenforo/src/ca.pem
--ssl-cert=/xenforo/src/client-cert.pem
--ssl-key=/xenforo/src/client-key.pem
-h forum.mysite.com
-u user34 -p
I can connect with a basic mysqli php script.
But it doesn't work when enabled:
$config['db']['ssl']['enabled'] = true; // Enable/disable SSL support
$config['db']['ssl']['key'] = 'src/client-key.pem'; // The path name to the key file.
$config['db']['ssl']['cert'] = 'src/client-cert.pem'; // The path name to the certificate file.
$config['db']['ssl']['ca'] = 'src/ca.pem'; // The path name to the certificate authority file.
Mysql error on the old server:
[Note] Got an error reading communication packets
[Note] Got an error reading communication packets
[Note] Got an error reading communication packets
Xenforo 2.2
MySQL5.7
PHP 8.3
Cheer! Hope this helps someone.
Upvote
0