Tuncay Sahin

ICT Engineer | Docent ICT & Trainer

This document describes the steps to get WordPress running on IIS and MS SQL Server. It assumes that Windows Server 2012 R2 x64 is already installed and preconfigured (networking, updates etc.)

Webserver (IIS)

Add the Webserver (IIS) Role through Server Manager.

    • Leave the standard options enabled.
    • Enable the “CGI” checkbox under “Application Development” group.
    • Enable the “.Net Extensibility 3.5” under “Application Development”  group.
    • Be sure http/https traffic is allowed to your server.

Install PHP Manager

This is a tool for managing PHP on IIS.

  1. First install .Net Framework 3.5 Features.
  2. Install PHP Manager 1.2 x64 for IIS (http://phpmanager.codeplex.com).
  3. First install Visual C++ Redistributable for Visual Studio 2012 Update 4 x86
  4. Download php-5.4.22-nts-Win32-VC9-x86 and extract to C:\PHP (Non-thread-safe build of PHP is recommended).

PHP for Windows

  • Run IIS Manager and load PHP Manager
  • Register new PHP version by browsing to C:\PHP\php-cgi.exe
  • Run check phpinfo() to check if PHP is working correctly.

Download and Extract the Microsoft Drivers 3.0 for SQL Server for PHP are PHP 5 extensions that allows for the reading and writing of SQL Server data from within PHP scripts. The PDO_SQLSRV extension implements PDO for accessing data in all editions of SQL Server 2005 and later.

    • Copy php_sqlsrv_54_nts.dll to C:\PHP\Ext
    • Enable this extension via PHP Manager in IIS.

Microsoft SQL 2012

Install Microsoft SQL 2012 Express Edition x64

    • Database Engine Services
    • Management Tools –Basic
    • Default Instance (MSSQLSERVER)
    • Mixed Mode Authentication

Install WordPress

Create a database with SQL Management Studio for your WordPress-site.

  • Create a SQL login with db_owner and db_securityadmin role assigned to your database.

Download WordPress and extract the package (for example C:\Websites\Wordpress)

  • Grant IIS (IUSR) Write Permissions to your WordPress Folder.
  • Add a website pointing to this directory.
  • Assign the corresponding HostName

WP Database Abstraction plugin

Download the WP Database Abstraction plugin package to make it possible to run WordPress on MS SQL Server.

  • Upload wp-db-abstraction.php and the wp-db-abstraction directory to wp-content/mu-plugins. This should be parallel to your regular plugins directory. You must create the mu-plugins directory.
  • Put the db.php file from inside the wp-db-abstraction.php directory to wp-content/db.php.
  • edit the translate_limit function in the mu-plugins/wp-db-abstraction/translations/sqlsrv/translations.php file:
    Change:

// Check for true offset

if ( (count($limit_matches) == 5  )  && $limit_matches[1] != ‘0’ ) {

$true_offset = true;

} elseif ( (count($limit_matches) == 5 )  && $limit_matches[1] == ‘0’ ) {

$limit_matches[1] = $limit_matches[4];

}

To:

// Check for true offset

if ( (count($limit_matches) == 5  )  && $limit_matches[1] != ‘0’ ) {

$true_offset = true;

} elseif ( (count($limit_matches) >= 5 )  && $limit_matches[1] == ‘0’ ) {

$limit_matches[1] = $limit_matches[4];

}

Browse to your http://hostname/ wp-content/mu-plugins/wp-db-abstraction/setup-config.php  and follow the screen instructions to setup your WordPress.

Meer informatie

Voor meer informatie of voor een persoonlijk adviesgesprek kunt u altijd vrijblijvend contact met mij opnemen.

E-Mail

info@tuncaysahin.nl