WordPress connecting to SQL Azure

Microsoft makes WordPress on Azure easier, but a tricky situation arises when we need to use MsSQL instead of MySQL for WordPress on Azure. I recently did a project that we migrated a website where wordpress connected to MySQL DB to WordPress, then connected to MsSQL DB. I made many mistakes and encountered many issues so I would like to share them here in hopes you will spared some headaches.


  1. WordPress
  2. WP-DB-AbstractionPlugin
    1. PHP extension sqlsrv driver installed (read this post http://docs.gurock.com/testrail-admin/howto-installing-sqlsrv)
    2. PHP (Only if you wish to run it on IIS)
    3. PHP Manager on IIS installed (Only if you wish to run it on IIS)
  3. SQL Server (On Azure, you need a SQL Azure)

WordPress connecting to MsSQL on IIS

To deploy WordPress on IIS, you need to:

  1. Install Microsoft SQL Management studio
  2. Install PHP on server
  3. Enable SQLSRV extension in PHP (read this post http://docs.gurock.com/testrail-admin/howto-installing-sqlsrv)
  4. Download WordPress at HERE. You can also do it via WebMatrix, but I recommend you download WordPress manually
  5. Create a website on IIS and making the application pool “No Managed Code”
  6. Before running the WordPress site, install WP-DB-Abstraction Plugin as MU-Plugin
  7. Run and Install WordPress on the site
    1. Follow the instruction and step 2 of the installation process, choose SQL server by using Microsft PHP driver -sqlsrv
  8. Done! Your site is running on MsSQL now!

Problems / Errors that I encounter during setup for WP-DB-Abstraction

  1. web-config.php exists (This is very important. Make sure it’s a pure copy or delete it)
  2. web-config-sample.php is missing
  3. Make sure your IIS can run PHP code
  4. Install SQLSRV extension on php. If this is not installed, the “SQL Server using Microsoft PHP Driver” option will not show up at the dropdown box during installation

WordPress connection to SQL Azure 

Now, we are ready to move the site to Azure

  1. Create a website on Azure. Upload an uninstalled copy of WordPress with WP-DB-Abstraction Plugin in place. Refer to the Section “WordPress connecting to MsSQL on IIS”
  2. Create a SQL Azure database
  3. Manage your website via Azure Portal, Go to Website -> Configuaration
    1. Under the App Setting Section, put in “PHP_EXTENSIONS” as the Key and your “php_sqlsrv.DLL” is located at VALUE. For me, I uploaded a folder called EXT in the root via FTP, so my key is “EXT/php_sqlsrv.DLL”
  4. Finishing the WordPress Installation
  5. Voila, everything should be working.

If you have any questions or comments, please email me at michael.siu@ideanotion.net. Follow our up-coming blogs next week. Have a nice weekend!

By Michael Siu

Posted in Technical
One comment on “WordPress connecting to SQL Azure
  1. Patrick says:

    There’s a new solution to this problem, especially if you intend to run on Windows Azure. http://ProjectNami.org

1 Pings/Trackbacks for "WordPress connecting to SQL Azure"
  1. […] If  you are running WordPress with MsSql Server (For me, it’s because I want to move to Azure) then the chances are you are using WP-DB-Abstraction Plugin. It is supported by the Microsoft SQL team. I was thinking to myself, if it’s supported by Microsoft team, it’s good enough of a reason for me to jump in and start using this plugin. For for information please view my previous page. […]

Leave a Reply