Jez*_*ers 6 php mysql wordpress ssl azure
我们在云服务上的主要 .NET 解决方案的子文件夹中运行 Wordpress。我们已将 MySQL 从 CloudDB 移至 Azure MySQL,但是只有在我们将“强制 SSL 连接”设置为禁用时它才会连接。
Wordpress wp-config.php 有以下内容
define('DB_SSL', true);
Run Code Online (Sandbox Code Playgroud)
我认为问题是我们需要传递证书,但我不清楚我们如何在 Wordpress 中设置它,以便在通过 SSL 连接时传递它。
这是我所做的:
获取 SSL 证书并将证书文件保存到我的 Wordpress 项目的根目录中。
将以下内容添加到wp-config.php
:
define('DB_SSL', true);
Run Code Online (Sandbox Code Playgroud)将其添加到db_connect()
我的wp-includes/wp-db.php
. 必须在以下之前调用mysqli_real_connect()
:
// Just add this line
mysqli_ssl_set($this->dbh, NULL, NULL, ABSPATH . 'BaltimoreCyberTrustRoot.crt.pem', NULL, NULL);
if ( WP_DEBUG ) {
mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags );
} else {
@mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags );
}
Run Code Online (Sandbox Code Playgroud)该解决方案看起来有点脏,但它对我有用。
归档时间: |
|
查看次数: |
2419 次 |
最近记录: |