Online Chat
 Call Us: 
1-877-744-1221
Browse Submit a Ticket
 
Advanced Search
Tools
Rss Categories

PHP drivers for Microsoft SQL (Windows + Apache)

Author: Edward Hardin Reference Number: AA-00748 Views: 69534 Last Updated: 02/13/2013 12:54 PM 0 Rating/ Voters

KMP uses Microsoft's SQLSRV driver, which installs as a PHP extension, to connect to a MSSQL database. This guide explains how to install this driver on Windows with Apache.

Supported PHP versions:

  • PHP v5.3.6+
  • PHP v5.4.*

Installation

Download the SQLSRV30.EXE file from the official Microsoft website.

Double click on the downloaded file. It is a self-extracting archive. It will ask you where to extract the files. Use a temporary target folder for this, you would need only one of the extracted files.

Check the upacked files. You can see a bunch of them, though you need only one file. You should use the Tread Safe version of PHP with Apache (if you're using a package like XAMPP, your PHP version is Tread Safe). If you're using PHP v5.3.6+, you would need this file:

php_sqlsrv_53_ts.dll

Or if you're using PHP v5.4+ the file would be this one:

php_sqlsrv_54_ts.dll

Copy the chosen file to the PHP extensions directory. By default it is C:\Program Files (x86)\PHP v5.4\ext or similar (for the latest XAMPP versions it is C:\xampp\php\ext by default). If you're not sure, check the "extension_dir" parameter in the php.ini file.

To load the sqlsrv dirver, add the following line to the php.ini (for PHP v5.3.6+):

extension=php_sqlsrv_53_ts.dll

Or

extension=php_sqlsrv_54_ts.dll

for PHP v5.4+.

Also, you would need to install Microsoft Visual C++ 2010 SP1 Redistributable Package (x86) on the web server.

Restart Apache.

To determine whether the driver has been successfully loaded, run a script that calls phpinfo().

Search for "sqlsrv" on that page (use Ctrl-F shortcut in your browser). If sqlsrv driver is installed correctly, you should see something like this:


Microsoft SQL Server 2012 R2 Native Client must also be installed on the server on which PHP is running. To download and install SQL Server 2012 R2 Native Client now, click on the link below that matches the Windows edition on the web server:

Custom Fields
This article applies to the following versions of Knowledgebase Manager Pro:6.0, 6.0.1, 6.0.2, 6.0.3,6.1.*
Applicable to these operation systems:Windows
Database type:MS SQL