Export (0) Print
Expand All

Configuring the Driver

This topic lists the configuration options for the SQL Server Driver for PHP and provides information about changing configuration settings.

To retrieve the driver's current configuration settings, use the sqlsrv_get_config function. To change the configuration settings, use the sqlsrv_configure function or set values for the configuration settings in the php.ini file. For details about changing the configuration settings, see How to: Configure Error and Warning Handling and Logging Activity.

The SQL Server Driver for PHP has three configuration options: LogSubsystems, LogSeverity, and WarningsReturnAsErrors. The default values for these settings are SQLSRV_LOG_SYSTEM_OFF, SQLSRV_LOG_SEVERITY_ERROR (after logging has been turned on), and true (1), respectively. The following sections describe these configuration options and their possible settings.

LogSubsystems Options

The LogSubsystems setting is used to turn on logging for subsystems. The following table lists the possible values for this setting.

Value (integer equivalent in parentheses) Description


Turns on logging of all subsystems.


Turns logging off. This is the default value.


Turns on logging of initialization activity.


Turns on logging of connection activity.


Turns on logging of statement activity.


Turns on logging of error functions activity (such as handle_error and handle_warning).

LogSeverity Options

The LogSeverity setting is used to specify what to log after logging has been turned on. The following table lists the possible values for this setting.

Value (integer equivalent in parentheses) Description


Specifies that errors, warnings, and notices will be logged.


Specifies that errors will be logged. This is the default value when logging is turned on.


Specifies that warnings will be logged.


Specifies that notices will be logged.

WarningsReturnAsErrors Option

The WarningsReturnAsErrors option is used to specify whether warnings generated by calls to sqlsrv functions are treated as errors. Setting this option to 1 (the default) means that warnings will be treated as errors. Setting this option to 0 means that warnings will not be treated as errors. For more information, see How to: Handle Errors and Warnings.

Community Additions

© 2014 Microsoft