3

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?

6
  • This is a php question, not a WordPress specific question for which you should seek an answer on the stackoverflow site which has several similar questions already answered.
    – Aurovrata
    Aug 21, 2018 at 15:41
  • 1
    @Aurovrata, come on dude. That's where I posted the question and I got voted down because they said it is stackexchange.com question. What the heck is wrong here?
    – Kenny
    Aug 21, 2018 at 15:56
  • Well, if you are installing separate php libraries in your WordPress installation folder then its a php question, I don't understand why you expect WordPress devs to answer that one for you. On the other hand if you want to use the WordPress framework to make a custom db connection then you ought to change your question to reflect that. I am trying to help you increase your chances of finding as answer here, no hard feelings!
    – Aurovrata
    Aug 21, 2018 at 16:06
  • For example, here is a WP specific question of someone trying to achieve soemthing similar, and they got see this answer.
    – Aurovrata
    Aug 21, 2018 at 16:08
  • 1
    @Aurovrata, just for clarity, I do not have issues connecting PHP to sql server. Infact, I have done that many times throughout my career. My issue is configuring wordpress to connect to SQL Server. Specifically, there is a file called wp-db.php inside wp-includes to gets called when I tried to test wordpress db setup. That's the file that is spitting out the error messages posted above. The link you referenced talks specifically to connecting to another MySQL.
    – Kenny
    Aug 21, 2018 at 19:49

1 Answer 1

1

I think there is a new approach to it:

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

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

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

2
  • Thank you for answering, but link only answers may be deleted as they become unhelpful once the links go dead. Please consider editing your answer and then paste in the relevant solution, supplementing it with a link to the source. Dec 16, 2018 at 21:05
  • @DaveRomsey, you are so right... but I don't have time to do that (screenshot, tests, etc...). Do you want me to delete the post? Dec 17, 2018 at 8:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.