SQL SERVER – 2005 – Driver for PHP Community Technology Preview (October 2007)

In its continued commitment to interoperability, Microsoft has released a new SQL Server 2005 Driver for PHP. The SQL Server 2005 Driver for PHP Community Technology Preview (CTP) download is available to all SQL Server users at no additional charge. The SQL Server 2005 Driver for PHP is a PHP 5 extension that allows for the reading and writing of SQL Server data from within PHP scripts. The extension provides a procedural interface for accessing data in all editions of SQL Server 2005 and SQL Server 2000.

SQL SERVER - 2005 - Driver for PHP Community Technology Preview (October 2007)

How to install driver
1. Download sqlsrv-for-php_version_language.exe to a temporary directory.
2. Run sqlsrv-for-php_version_language.exe.
3. Enter an installation directory when prompted. It is recommended that you extract the file to %ProgramFiles% with the default directory: “Microsoft SQL Server 2005 Driver for PHP”.
4. After extracting the files, read the Installation section of the Php_sqlsrv_readme.txt file for next steps.

Download the Driver

What Happened to the SQL Server Driver for PHP

This CTP was only the first step. The driver went on to full releases and is still available today under the name Microsoft Drivers for PHP for SQL Server, with its source code published on GitHub. The current package has two extensions: sqlsrv, which keeps the procedural style described above, and pdo_sqlsrv, which works with the PDO layer of PHP.

If you set it up on a new machine, a few points save time:

  • Pick the build that matches your PHP version and whether your PHP is thread safe or not. A mismatch usually means the extension does not load at all.
  • Newer versions of the driver need the Microsoft ODBC Driver for SQL Server installed on the same machine.
  • Run phpinfo() to confirm the extension is loaded before you start writing code.

When you write the code, pass values as parameters instead of building SQL strings by hand. Both extensions support parameterized queries, and that one habit protects you from SQL injection. Also create a separate login for the web application with only the rights it needs. A website should never connect as sa. Check the documentation for the driver version you install, because the list of supported PHP versions changes over time.

Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.

SQL Download, SQL Utility
Previous Post
SQL SERVER – 2005 – SQL Server Surface Area Configuration Tool Examples and Explanation
Next Post
SQL SERVER – Three T-SQL Script to Create Primary Keys on Table

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.