PHPackages                             silverstripe/mssql - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. silverstripe/mssql

ActiveSilverstripe-vendormodule[Database &amp; ORM](/categories/database)

silverstripe/mssql
==================

Adds MSSQL support to SilverStripe

2.0.3(5y ago)157.8k25[6 issues](https://github.com/silverstripe/silverstripe-mssql/issues)[1 PRs](https://github.com/silverstripe/silverstripe-mssql/pulls)1PHPCI failing

Since Jan 3Pushed 11mo ago12 watchersCompare

[ Source](https://github.com/silverstripe/silverstripe-mssql)[ Packagist](https://packagist.org/packages/silverstripe/mssql)[ RSS](/packages/silverstripe-mssql/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (7)Dependencies (3)Versions (14)Used By (1)

SQL Server Database Module
==========================

[](#sql-server-database-module)

Allows SilverStripe to use SQL Server databases including SQL databases on Azure.

[![Build status](https://camo.githubusercontent.com/c4250ff00fbca18784d09f81a2155fb3d62aed92aa70519fd6305df3e72a1b23/68747470733a2f2f63692e6170707665796f722e636f6d2f6170692f70726f6a656374732f7374617475732f686570306c356b62687536346e376c332f6272616e63682f6d61737465723f7376673d74727565)](https://ci.appveyor.com/project/silverstripe/silverstripe-mssql/branch/master)[![Version](https://camo.githubusercontent.com/a66d527d324f664e43ac586ecaa6545681e54b0643cc9417b74facd986e36ac2/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73696c7665727374726970652f6d7373716c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/silverstripe/mssql)[![License](https://camo.githubusercontent.com/93b4ecfd68724a07b29fc789497a2b87f488bfa05cf57866c6b50fb4c57202fd/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f73696c7665727374726970652f6d7373716c2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

Requirements
------------

[](#requirements)

- SilverStripe 4+
- SQL Server 2008, 2008 R2, or 2012.

`mssql` PHP api is no longer supported as of 2.0.

### \*nix

[](#nix)

Linux support is only available via the PDO extension. This requires:

- [dblib](http://www.php.net/manual/en/ref.pdo-dblib.php)
- [FreeTDS](http://freetds.org)

### Windows

[](#windows)

On windows you can either connect via PDO or `sqlsrv`. Both options require the [SQL Server Driver for PHP](https://msdn.microsoft.com/library/dn865013.aspx?f=255&MSPPError=-2147217396). "sqlsrv" 3.0+

Note: [SQL Server Express](http://www.microsoft.com/express/Database/) can also be used which is provided free by Microsoft. However, it has limitations such as 10GB maximum database storage.

Installation
------------

[](#installation)

```
composer require silverstripe/mssql ^2

```

The following environment variables will need to be set:

```
SS_DATABASE_CLASS="MSSQLAzureDatabase" # or: `MSSQLDatabase` or `MSSQLPDODatabase`
SS_DATABASE_SERVER=""
SS_DATABASE_NAME=""
SS_DATABASE_USERNAME=""
SS_DATABASE_PASSWORD=""

```

Note on OSX / Linux machines you will need to install the ODBC drivers and the PHP extension `sqlsrv` or `pdo_sqlsrv`

-
-

Troubleshooting
---------------

[](#troubleshooting)

*Q: SQL Server resides on a remote host (a different machine) and I can't connect to it from mine.*

A: Please ensure you have enabled TCP access using **SQL Server Configuration Manager** and [opened firewall ports](http://msdn.microsoft.com/en-us/library/ms175043.aspx).

*Q: I just installed SQL Server, but it says that it cannot connect*

A: Sometimes SQL Server will be installed as a non-default instance name, e.g. "SQLExpress" instead of "MSSQLSERVER" (the default.) If this is the case, you'll need to declare the instance name when setting the server in your PHP database configuration. For example: **(local)\\SQLExpress**. The first part before the slash indicates the server host, or IP address. In this case, (local) indicates localhost, which is the same server PHP is running on. The second part is the SQL Server instance name to connect to.

*Q: I'm getting unicode SQL Server errors connecting to SQL Server database (e.g. Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier)*

A: If you are using FreeTDS make sure you're using TDS version 8.0 in **freetds.conf**. If on Windows, ensure you use the [SQL Server Driver for PHP](http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=ccdf728b-1ea0-48a8-a84a-5052214caad9)and **NOT** the mssql drivers provided by PHP.

*Q: Using FreeTDS I can't connect to my SQL Server database. An error in PHP says the server doesn't exist*

A: Make sure you've got an entry in **/etc/freetds/freetds.conf** that points to your server. For example:

```
[myserver]
	host = myserver.mydomain.com
	port = 1433
	tds version = 8.0

```

Then you can use "myserver" (the bit in square brackets above) as the server name when connecting to the database. Note that if you're running Macports, the file is located in **/opt/local/etc/freetds/freetds.conf**.

Alternatively, if you don't want to keep adding more entries to the freetds.conf to nominate more SQL Server locations, you can instead use the full the host/ip and port combination, such as "myserver:1433" (1433 being the default SQL Server port.) and ensure the "tds version = 8.0" is set globally in the freetds.conf file.

**Note**: Use *tabs* not spaces when editing freetds.conf, otherwise it will not load the configuration you have specified!

**Note**: Certain distributions of Linux use [SELinux](http://fedoraproject.org/wiki/SELinux) which could block access to your SQL Server database. A rule may need to be added to allow this traffic through.

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance30

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community32

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~244 days

Recently: every ~266 days

Total

13

Last Release

1949d ago

Major Versions

0.8.x-dev → 1.0.02016-07-03

0.10.x-dev → 1.0.12017-02-12

1.0.2 → 2.0.02017-12-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/b0cba8b534e20e6ab4fff555a97b237a18436ebca1446fc0b29c8a8b504038b9?d=identicon)[GuySartorelli](/maintainers/GuySartorelli)

![](https://avatars.githubusercontent.com/u/111025?v=4)[Ingo Schommer](/maintainers/chillu)[@chillu](https://github.com/chillu)

![](https://www.gravatar.com/avatar/a25bc04c5720a36869d5a39c6449dde7eb43e19b7c8e666d5f632d6a9ab440b1?d=identicon)[emteknetnz](/maintainers/emteknetnz)

![](https://www.gravatar.com/avatar/afbb3dcc9ef29c1a6eedd6addcae5fce9ab1271915a85a4c349301b71237368d?d=identicon)[silverstripe-machine01](/maintainers/silverstripe-machine01)

![](https://www.gravatar.com/avatar/be6648e60fbab6f70bfc34dd8c14259562d28a47510a934ea9c01fe98633f3c2?d=identicon)[sminnee](/maintainers/sminnee)

![](https://avatars.githubusercontent.com/u/1168676?v=4)[Maxime Rainville](/maintainers/maxime-rainville)[@maxime-rainville](https://github.com/maxime-rainville)

---

Top Contributors

[![geoff-silverstripe](https://avatars.githubusercontent.com/u/318115?v=4)](https://github.com/geoff-silverstripe "geoff-silverstripe (38 commits)")[![wilr](https://avatars.githubusercontent.com/u/101629?v=4)](https://github.com/wilr "wilr (18 commits)")[![mateusz](https://avatars.githubusercontent.com/u/118653?v=4)](https://github.com/mateusz "mateusz (12 commits)")[![halkyon](https://avatars.githubusercontent.com/u/138450?v=4)](https://github.com/halkyon "halkyon (12 commits)")[![chillu](https://avatars.githubusercontent.com/u/111025?v=4)](https://github.com/chillu "chillu (10 commits)")[![rixth](https://avatars.githubusercontent.com/u/116910?v=4)](https://github.com/rixth "rixth (9 commits)")[![dhensby](https://avatars.githubusercontent.com/u/563596?v=4)](https://github.com/dhensby "dhensby (8 commits)")[![ajoneil](https://avatars.githubusercontent.com/u/460342?v=4)](https://github.com/ajoneil "ajoneil (5 commits)")[![simonwelsh](https://avatars.githubusercontent.com/u/125915?v=4)](https://github.com/simonwelsh "simonwelsh (3 commits)")[![tractorcow](https://avatars.githubusercontent.com/u/936064?v=4)](https://github.com/tractorcow "tractorcow (3 commits)")[![lozcalver](https://avatars.githubusercontent.com/u/1655548?v=4)](https://github.com/lozcalver "lozcalver (2 commits)")[![kmayo-ss](https://avatars.githubusercontent.com/u/1711912?v=4)](https://github.com/kmayo-ss "kmayo-ss (1 commits)")[![ss23](https://avatars.githubusercontent.com/u/191510?v=4)](https://github.com/ss23 "ss23 (1 commits)")[![brettt89](https://avatars.githubusercontent.com/u/4122344?v=4)](https://github.com/brettt89 "brettt89 (1 commits)")[![nicole-ashley](https://avatars.githubusercontent.com/u/2626677?v=4)](https://github.com/nicole-ashley "nicole-ashley (1 commits)")

---

Tags

databasemssqlsilverstripe

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/silverstripe-mssql/health.svg)

```
[![Health](https://phpackages.com/badges/silverstripe-mssql/health.svg)](https://phpackages.com/packages/silverstripe-mssql)
```

###  Alternatives

[silverstripe/postgresql

SilverStripe now has tentative support for PostgreSQL ('Postgres')

16258.1k2](/packages/silverstripe-postgresql)[cycle/database

DBAL, schema introspection, migration and pagination

64690.9k31](/packages/cycle-database)[brettt89/silverstripe-garbage-collector

SilverStripe Garbage Collector module

109.6k](/packages/brettt89-silverstripe-garbage-collector)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
