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

SQLSRV_LOG_SYSTEM_ALL (-1)

Turns on logging of all subsystems.

SQLSRV_LOG_SYSTEM_OFF (0)

Turns logging off. This is the default value.

SQLSRV_LOG_SYSTEM_INIT (1)

Turns on logging of initialization activity.

SQLSRV_LOG_SYSTEM_CONN (2)

Turns on logging of connection activity.

SQLSRV_LOG_SYSTEM_STMT (4)

Turns on logging of statement activity.

SQLSRV_LOG_SYSTEM_UTIL (8)

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

SQLSRV_LOG_SEVERITY_ALL (-1)

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

SQLSRV_LOG_SEVERITY_ERROR (1)

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

SQLSRV_LOG_SEVERITY_WARNING (2)

Specifies that warnings will be logged.

SQLSRV_LOG_SEVERITY_NOTICE (4)

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

Show:
© 2014 Microsoft