Sql server connection:
For connecting sql server to php first we have to download supported drivers of sql server.
Step-1: First check your php version in command prompt window

Step-2: Search for Microsoft sql drivers and view details and system requirements for choosing the drivers based on your php version

Step-3: Download the driver based on your php version

Step-4: For knowing about php information write the below code for selection the drivers

Step-5: After running the code in web server configuration settings page will be displayed

Step-6: Go to drivers-setup file and select and copy the required drivers

Step-7: Go to c drive -> program files ->php -> select your php version folder and select and open configuration settings file in notepad

Step-8: Save the drivers in configuration settings file

Step-9: Checking whether the connection established to the sql server or not
Code:

Output:

For connecting sql server to php first we have to download supported drivers of sql server.
Step-1: First check your php version in command prompt window
Step-2: Search for Microsoft sql drivers and view details and system requirements for choosing the drivers based on your php version
Step-3: Download the driver based on your php version
Step-4: For knowing about php information write the below code for selection the drivers
Step-5: After running the code in web server configuration settings page will be displayed
Step-6: Go to drivers-setup file and select and copy the required drivers
Step-7: Go to c drive -> program files ->php -> select your php version folder and select and open configuration settings file in notepad
Step-8: Save the drivers in configuration settings file
Step-9: Checking whether the connection established to the sql server or not
Code:
Output: