Bootstrap FreeKB - PHP - Install the SQL Server driver in the php.ini file
PHP - Install the SQL Server driver in the php.ini file

Updated:   |  PHP articles

Determine if PHP currently supports SQL Server functions, such as the sqlsrv_connect function. If no matches are found, PHP does not have support for SQL Server.

  1. Load the phpinfo.php page in a Web browser (http://www.example.com/phpinfo.php)
  2. Press Ctrl F, type sqlsrv, and press Enter.

 

Follow these steps to download the PHP SQL Server DLL files.

  1. Go to https://www.microsoft.com/en-us/download/details.aspx?id=20098
  2. Select the Download button
  3. Check SQLSRV32.EXE and select Next
  4. If prompted to run or save the file, select Save
  5. Go to your Downloads folder
  6. Create a new folder named SQLSRV32
  7. Run the SQLSRV32 executable file
  8. In the Microsoft Drivers 3.2 for PHP for SQL Server dialog box, select Yes to accept the end user license agreement (EULA)
  9. When prompted to select a directory to extract the driver, select C:/Users/username/Downloads/SQLSRV32. The extract should complete, and about 10 .dll files will be extracted to the SQLSRV32 folder.
  10. Move the .dll files from C:/Users/username/Downloads/SQLSRV32 to the directory where the .dll files are stored, which is probably C:/PHP/ext or C:/Program Files/PHP/vx.x/ext/.

 

Edit the PHP.ini file:

  1. Open the PHP.ini file in a text editor, such as notepad or notepad++. The PHP.ini file will probably be listed at C:/PHP/PHP.ini or C:/Program Files/PHP/vx.x/PHP.ini.
  2. Locate the Extensions area of the PHP.ini file. This might be at the very bottom of the file.
  3. Add the following to the Extensions area:
Extension=php_sqlsrv_56_ts.dll
  1. Save and close the PHP.ini file.

 

Restart IIS:

  1. In the left panel of IIS, select the root directory
  2. In the right panel of IIS, select Restart

 

Verify the php_sqlsrv_56_ts.dll file is enabled:

  1. In the middle area of IIS, select PHP Manager
  2. Select Eanble or disable an extension
  3. Ensure php_sqlsrv_56_ts.dll is listed and Enabled

 

Verify PHP now supports SQL Server functions:

  1. Load the phpinfo.php page in a Web browser (http://www.example.com/phpinfo.php)
  2. Press Ctrl F, type sqlsrv, and press Enter.

If no matches are found, PHP does not have support for SQL Server.

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 41c74e in the box below so that we can be sure you are a human.