AQuirky
AQuirky

Reputation: 5236

Deploy Mediawiki to Azure: no SSL Connection

I'm trying to deploy mediawiki to Azure Web App. I created the app using Linux and PHP 7.3. I unpacked WikiMedia 1.35.1 into wwwroot and used the browser to run the installation

I want to use MySQL for Azure as the database. So I enter the mysql.database.azure.com parameters and press install.

The error I get is

Cannot access the database: :real_connect(): (HY000/9002): SSL connection is required.

The docs say I need to set $wgDBssl to true in LocalSettings.php.

The problem is that LocalSettings.php does not exist yet. How do I specify an SSL connection during installation?

Upvotes: 0

Views: 486

Answers (2)

prplPwny
prplPwny

Reputation: 11

I was able to work around this issue by forcing the following clause in /includes/libs/rdbms/database/DatabaseMysqli.php to always be true by adding || true at the right place between the two closing parentheses:

if ( $this->getFlag( self::DBO_SSL ) || true ) {
    $flags |= MYSQLI_CLIENT_SSL;
    $mysqli->ssl_set(
        $this->sslKeyPath,
        $this->sslCertPath,
        $this->sslCAFile,
        $this->sslCAPath,
        $this->sslCiphers
    );
}

Maybe there's a more elegant way to make the original condition $this->getFlag( self::DBO_SSL ) to evaluate as true naturally?

Upvotes: 1

Xeno
Xeno

Reputation: 47

I am trying to figure out the same dilemma and hoping someone with more PHP knowledge can provide a better answer. As a work around, you can disable "Enforce SSL" on your MySQL database in Azure. Then you can run the setup, create the localSettings.php file. After which you can add the settings for $wgDBssl and re-enable enforce ssl setting.

To my knowledge, a connection to the database is being using the "/includes/installer/MysqlInstaller.php" when running the setup. In the "DatabaseMysqli.php" and "Database.php" of /includes/libs/rdbms/database/ directory these two files are used for connecting to the database when running any query.

I am trying to see if there is a way to set the SSL setting in these 3 files first then run the setup and application. Apologies that I've entered this as an answer also. I am new to StackOverflow and cannot create comments yet.

Upvotes: 1

Related Questions