The PHP on Windows and SQL Server Training Kit includes a comprehensive set of technical content including demos and hands-on labs to help you understand how to build PHP applications using Windows, IIS 7.5 and SQL Server 2008 R2. This release includes the following:

PHP & SQL Server Demos
- Integrating SQL Server Geo-Spatial with PHP
- SQL Server Reporting Services and PHP
PHP & SQL Server Hands On Labs
- Introduction to Using SQL Server with PHP
- Using SQL Server Full-Text Search and FILESTREAM Storage with PHP
- New: Getting Started with SQL Server Migration Assistant for MySQL
Download SQL Server PHP on Windows and SQL Server Training Kit
PHP and SQL Server Today
The training kit is from the SQL Server 2008 R2 days, but the idea behind it is very much alive. The piece that connects PHP to SQL Server is the Microsoft Drivers for PHP for SQL Server. It gives you two extensions. The first is sqlsrv, which has its own set of functions. The second is pdo_sqlsrv, which works with the standard PDO interface of PHP. If you are starting a new project, I suggest PDO, because the same style of code works with other databases too.
The drivers are open source now, and they are not only for PHP on Windows anymore. They run on Linux and macOS as well. Before you blame your code for a connection error, run php -m from the command prompt and make sure sqlsrv or pdo_sqlsrv shows up in the list. The drivers also need the Microsoft ODBC Driver for SQL Server installed on the same machine. That is the step people miss most, and it gives a confusing error when it is missing. Install the ODBC driver first, then test your connection again. It is a simple fix once you know where to look.
Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.





1 Comment. Leave new
This is cool)