How do I configure WordPress to talk to a Microsoft SQL Server database?

We have are building a WordPress site on our intranet site and wish to connect it to a Microsoft SQL Server.

I have downloaded and configured PHP and PHP Manager on IIS.

I have also downloaded SQL Server DLL from the list of answered questions that popped on as I was typing the title of this thread.

I downloaded those DLLs inside the PHP folder as instructed.

When I fired up the server address to install WordPress, I was prompted to provide SQL DB name, username, password and DB hostname.

I have also downloaded wp-db-Abstraction plugin, put the wp-db-abstraction.php file into the folder where the WordPress files are saved, put the wp-db-abstraction folder into wp_content as instructed by the online article I was reading. Inside this folder, there is a db.php file. I also copied this db.php file into foldername where the rest of the downloaded WordPress files reside.

When I clicked to continue, I got the following error messages:

Warning: mysqli_real_connect(): (HY000/2002): No connection could be made because the target machine actively refused it. in E:\foldername\wp-includes\wp-db.php on line 1538

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in E:\foldername\wp-includes\wp-db.php on line 1569
Warning: mysql_connect(): No connection could be made because the target machine actively refused it. in E:\foldername\wp-includes\wp-db.php on line 1569

Error establishing a database connection

What is weird about the error is that it is coming from WP_Includes folder where there is another wp-db.php. This folder came with the WordPress downloaded files.

The weird thing is that the error above is coming from wp-db.php file, not from the db.php file I downloaded.

Am I supposed to remove db.php include file from the list?

Can anyone please tell me what I am missing?

1 Answer
1

I think there is a new approach to it:

  • https://blogs.msdn.microsoft.com/brian_swan/2010/05/12/running-wordpress-on-sql-server/

You can also use a 3rd party version of WordPress (not my cup of tea, by the way):

  • https://code.google.com/archive/p/wordpress-mssql/

  • https://github.com/ProjectNami/projectnami

Or follow this guide, but it might be a bit old:

  • https://blog.building-blocks.com/installing-wordpress-on-windows-using-sql-server-2008-r2-part-1/

In the end I think the first link would be the best approach. Please comment if you have any problem during the installation.

Leave a Comment