Support » Plugin: WP Db Abstraction » [Plugin: WP Db Abstraction] WP DB Abstraction unable to connect to database

  • Hi,

    I’ve been struggling to install WordPress on my local server using the WP DB Abstraction plug-in and MS SQL Server. I followed the instructions to the letter. Yet no matter what permissions I set my wp-config.php file is not created so I created it manually by modifying the values and adding the define DB_TYPE line.

    Now when I run wp-admin/install.php I keep getting “Error establishing a database connection” but I have checked the 3 suggestions in that error page as follows:

    •Are you sure you have the correct username and password?

    •Are you sure that you have typed the correct hostname?
    Well I’m never sure whether it should be “localhost” or “localhost\SQLEXPRESS” or “MYSERVERNAME\SQLEXPRESS” or “” but I have tried all the combinations I can and still no luck.

    •Are you sure that the database server is running?

    Anybody tell me 1) Any other suggestions OR 2) A correct troubleshooting process.
    There are just so many variables that could go wrong (Database, Webserver, PHP, directory permissions, Abstraction files etc) and I can’t seem to narrow it down. I’ve been trying for days and searching for answers too (Yeah, Famous 5-minute install…not for me!)


Viewing 12 replies - 1 through 12 (of 12 total)
  • I have started with the normal WordPress files extracted and set up in my web folder. Then added the mu-plugins abstraction part of the tree; dropped the db.php back to the Content folder; then used the setup-config.php located int the “\mu-plugins\wp-db-abstraction\” folder. I used the “SQL Server using MS PHP driver” from the dropbox. For the database, I pointed to “MYSERVER\SQLEXPRESS” and made sure the database was set up and in mixed mode. There’s a lot of other settings and conditions that could prevent the connection, so I don’t know where to start to help you.

    Mine worked for SQL Server Express 2012 with the 5.4.x sqlsrv extensions, but on another server I’m trying to repeat the same steps to connect to SQL Server 2008R2; It won’t connect. So I’m stuck there.

    If you can get where the setup-config.php file I used (above) and you can see the drivers selection in the dropbox, I would assume they are loaded properly in IIS. If you can’t get there, then php isn’t set up correctly. After that, it could be your SQL Native Client settings (pipes,tcp, etc).

    If you have already fixed it please report back what you did. It might help me on the SQLSRV 2008R2. If not, throw out some more areas here where you’re just guessing and maybe I’ll see a problem.

    Good luck.

    Hi, thanks for your reply.
    I did everything you said in your first paragraph with no joy. However your second paragraph is interesting because my SQL Server version IS the 2008 one.
    I can get the drivers showing in the dropbox so I think the PHP is set up. Phpinfo() can also be run and shows the drivers loaded. However it never seems to create the wp-config.php file like it should (I’ve checked the folder permissions!) so I have created it manually.
    As you say a lot of settings and conditions to check. Unfortunately I’m just not finding the problem. When you say “SQL Native Client settings” what do you mean? I created the database using SQL Management Studio and created a Login as per the WordPress install instructions. At first the db was not in mixed mode but I changed that. Apart from that is there anything I should change?

    hottroc –
    try changing your IIS settings on the website under Manage Website > Advanced Settings. Then hoose Physical Path Credentials and put in an account which has write access to the website directory. That should allow the setup to create the we-config.php file.

    Make sure you’ve installed the SQL Server 2008 R2 native client. It will be listed in the Programs and Features menu of the server as “Microsoft SQL Server 2008 Native Client”. My version is 10.0.1600.22.

    Here is a quick summary of my server 2008 installed items. Hope this helps with your configuration:
    1.Install and Configure PHP 5.3.14 for IIS (non-thread safe)
    2.Create IIS site, application pool and test page
    •Verified install by running phpinfo() function on test page

    3.Download and install Microsoft Drivers for PHP for SQL Server, NOTE: get version 2.0 and install the RC9 compiled version –
    •Verified by checking phpInfo() should show sqlsrv as a module installed

    4.Download WordPress 3.4.1 x86 version and extracted contents to the website root •Verified by navigating to the website and prompted with a “missing configuration page”

    5.Download and install DB Abstraction plugin 1.1.4 (details read carefully:
    6.Visit the site home and click through until you are given the option to install using the Microsoft SQL Provider

    Thanks for your suggestions. I do wonder if this could be an incompatibility between different versions of the various components required. For example my version of SQL Server 2008 R2 native client is 10.50.1600.1 …When you said “Programs and Features menu of the server” you mean the Programs and Features from within Control Panel I presume? I couldn’t find mention of it anywhere else. And I can’t remember now whether I installed the non-thread safe version of PHP, I think it might have been the thread-safe version. Also I am using a 64-bit OS with a 64-bit browser too if that makes a difference.
    Apart from that I think I’ve pretty much done the same.

    hottroc –
    FWIW my server is also a x64 architecture with a 64 bit OS. Yes, you are correct about the Programs and Features menu within Control Panel.

    It sounds like you’ve verified the SQLSRV plugin for PHP was installed properly. But let’s take a step back and verify what version of php you have installed.

    According to the readme in the MS Driver 3.0 for PHP for SQL if your PHP DLL is php5ts.dll then you are using the thread safe version. If the PHP DLL is php5.dll then you are using non thread safe.

    If you are using the thread safe then install the 5.3 or 5.4 dll (php_sqlsrv_54_ts.dll or php_sqlsrv_53_ts.dll).
    Otherwise, install the non thread safe version (php_sqlsrv_53_nts.dll or php_sqlsrv_54_nts.dll).

    Once that is working and your phpinfo() test page shows the sqlsrv plugin installed let’s move on to other prerequisites.


    Hi, you might be onto something here.
    This is the section from phpinfo…

    sqlsrv support enabled

    Directive Local Value Master Value
    sqlsrv.LogSeverity 0 0
    sqlsrv.LogSubsystems 0 0
    sqlsrv.WarningsReturnAsErrors On On

    I have php5.dll in my folder so I guess it’s non-thread-safe. But I seem to have lots of relevant dll’s in the ext directory, both thread-safe and non-thread safe. None are quite the same as yours though as they all have _vc6 or _vc9 in the filename like…


    How do I know which one it’s using?
    Think I might try downloading them again.

    OK, so you are using the 2.0 driver. Here is some text from the readme in the donwload regarding the VC9 portion:

    If the name of the driver file contains “vc9”, it should be used with a PHP version compiled with Visual C++ 9.0.

    Otherwise the same convention applies to the filename in my previous post.

    OK, so should I use the 3.0 driver instead (I think I’ve tried both along the way). Also how am I supposed to know how my PHP was compiled? And which file in particular are you referring to?

    I think you should use the 3.0 driver. I’ve tested this with SQL Server 2008 R2 and the SQL Server 2012 Native Client and they work. Just make sure to download the latest SQL native client on your web server.

    As far as I can tell, every version of PHP version 5.3 and up are VC9 compiled.

    I would delete all the drivers in your PHP extensions directory and only copy over the recommended one (see the readme HTML file in the folder). Let me know if you have questions.

    OK I’ll try out your suggestions and let you know how I get on. Bit tied up just now but soon. Thanks for your assistance.

    I tried the suggestion but no luck. What can I try next?

    My gut feeling is that this could be a problem with SQL server rather than any other elements of the equation. Apart from adding a database and login as per the WP instructions is there anything else I need to do, like Roles or anything? I’m not very SQLSrv savvy.
    Or it might be some Permission problem somewhere perhaps? Doh, so many possibles.

    OK finally got it working. I don’t know about Famous 5-minute install…for me it was an infamous 5-week install!

    I’m not sure exactly what fixed it, I tried changing several settings on the webserver and the database, settings such as the ASP version the website used, the database Roles and various permissions on both. (Also tried 3 different webservers)

    Maybe the instructions could be better in terms of what settings should be set or unset in case people haven’t got the norm (I don’t know why but I never seem to have the norm!).

    Anyway thanks to everyone for trying to help and giving me some ideas what to check etc. I can at least confirm quite definitely that WordPress DOES work on Microsoft SQL Server 2008. Before I started this I read many topics where they said it didn’t, only on MySQL, but they are obviously wrong. If any Moderators are reading this, you ought to correct a few of those topics, some people might be put off using WP for that reason (I nearly was!).

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘[Plugin: WP Db Abstraction] WP DB Abstraction unable to connect to database’ is closed to new replies.