PHP Manual
Prev |  | Next

# LVIII. Microsoft SQL Server functions

# Introduction

These functions allow you to access MS SQL Server database.

> Note: The MSSQL extension is available on Win32 systems only. You can use the Sybase extension to connect to MSSQL databases from other platforms.

# Requirements

The extension requires the MS SQL Client Tools to be installed on the system where PHP is installed. The Client Tools can be installed from the MS SQL Server CD or by copying `ntwdblib.dll` from `\winnt\system32` on the server to `\winnt\system32` on the PHP box. Copying `ntwdblib.dll` will only provide access. Configuration of the client will require installation of all the tools.

# Installation

The MSSQL extension is enabled by adding extension=php_mssql.dll to `php.ini`.

# Runtime Configuration

The behaviour of these functions is affected by settings in `php.ini`.

Table 1. MS SQL Server configuration options

Name | Default | Changeable
--- | --- | ---
mssql.allow_persistent | "1" | PHP_INI_SYSTEM
mssql.max_persistent | "-1" | PHP_INI_SYSTEM
mssql.max_links | "-1" | PHP_INI_SYSTEM
mssql.min_error_severity | "10" | PHP_INI_ALL
mssql.min_message_severity | "10" | PHP_INI_ALL
mssql.compatability_mode | "0" | PHP_INI_ALL
mssql.connect_timeout | "5" | PHP_INI_ALL
mssql.timeout | "60" | PHP_INI_ALL
mssql.textsize | "-1" | PHP_INI_ALL
mssql.textlimit | "-1" | PHP_INI_ALL
mssql.batchsize | "0" | PHP_INI_ALL
mssql.datetimeconvert | "1" | PHP_INI_ALL
mssql.secure_connection | "0" | PHP_INI_SYSTEM
mssql.max_procs | "25" | PHP_INI_ALL

For further details and definition of the PHP_INI_* constants see ini_set().

# Resource Types

# Predefined Constants

The constants below are defined by this extension, and will only be available when the extension has either been compiled into PHP or dynamically loaded at runtime.

`MSSQL_ASSOC` (integer)

`MSSQL_NUM` (integer)

`MSSQL_BOTH` (integer)

`SQLTEXT` (integer)

`SQLVARCHAR` (integer)

`SQLCHAR` (integer)

`SQLINT1` (integer)

`SQLINT2` (integer)

`SQLINT4` (integer)

`SQLBIT` (integer)

`SQLFLT8` (integer)

Prev | Home | Next
mime_content_type | Up | mssql_bind