PHP Function SQLSRVConnect
The php function sqlsrv_connect is an API function for connecting to a Microsoft SQL Server database using the sqlsrv driver. It is an alternative to the mssql drivers that were deprecated in PHP 5.3. The sqlsrv driver requires the Microsoft SQL Server Native Client be installed on your server, which is not included by default in the PHP package.
The sqlsrv_connect function accepts an associative array of key/value pairs that configure connection options. These are used to set the default database (USE dbName), authentication method and other connection properties. The SQLSRV driver also supports connection pooling which can improve performance by allowing multiple connections to be established and shared amongst scripts. To enable it, include 'UID' and 'PWD' in the $connectionOptions array.
Unlike the mssql functions, sqlsrv_connect does not require that you use double quotation marks around your SQL strings. However, it is recommended that you do so for clarity and to avoid potential security vulnerabilities.
Note: sqlsrv_connect() can be called either with or without the 'use' argument, depending on your needs. If the 'use' argument is not used, a new SQLSRV connection will be created for each call to the function. If it is, the current SQLSRV connection will be used for all subsequent queries.
This extension is only available in PHP versions up to 5.3 and has reached EOL. The EasyApache 4 distribution does not support this extension anymore and we recommend you to install the pdo_sqlsrv or pdo_odbc extensions instead.