How to properly configure SSL connection to remote azure database for running queries within a WordPress environment

Question

We do not want to replace our existing db, just run queries through SSL connection against that db from our WordPress.

You can create new WPDB objects to connect directly to new MySQL/MariaDB instances, but there is no support for tunnels, it is a direct connection only. For anything else you’d need to proxy it somehow and connect to the proxy, but this would be a non-WordPress non-PHP application that you would need to research and setup yourselves.

Likewise there is no support for non-MariaDB/MySQL databases, unless Azure DB can handle MySQL flavoured SQL as is without modification then WPDB is useless to you. WPDB uses mysqli internally.

The most you could expect WPDB to deviate from MariaDB/MySQL norms is SQLite, for which there are plugins that try to add support for.

Additionally, you should expect a heavy performance penalty for connecting to a remote database, regardless of the vendor or type of software at the other end. Remote requests and connections are one of the most expensive and slowest things you can do. Sites are normally colocated with their database for a reason, either on the same machine, or in the same data centre cluster for lower latency and turn around time. Your page will never load faster than the time it takes to do a request to your remote database, you will want a lot of caching and to make things as async as possible.

Instead you should stop searching WordPress resources, and instead try to find generic PHP resources, it’s extremely unlikely you will find anything WordPress specific.

We found a possible plugin (WP data access plugin)

This plugin has little or nothing to do with what you want.

We assume since we have a web server we can attempt to manage this connection outside of the WordPress instance itself, but that feels hacky.

You’ll need to treat this as a PHP application task that just happens to be inside WordPress. Look at generic PHP libraries, and their examples, and fit that into your WordPress code, or, have some other application that sits in-between WP and your Azure DB that can handle requests.

0
Benjamin J. Love 5 days 2022-11-24T10:46:48-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse