- In this article. Download PHP Driver. The Microsoft Drivers for PHP for SQL Server enable integration with SQL Server for PHP applications. The drivers are PHP extensions that allow the reading and writing of SQL Server data from within PHP scripts.
- An early technical preview of the Microsoft Driver 4.0.3 for PHP for SQL Server is now available for download. You can use this driver to connect your PHP application with Microsoft SQL Server. This means we can now access SQL Server, Azure SQL Database and Azure SQL from our PHP 7 apps.
- If you use PDO SQLSRV on windows 7, using 32 bit php on XAMMP, you might encounter driver problems: 'This extension requires the Microsoft ODBC Driver 11 for SQL Server to communicate with SQL Server'.
PHP Driver New project: downloads will be posted here as soon as they are available. For the latest development news, see the Development page for this driver. As of PHP 5.4, the mysqlnd library is a php.net compile time default to all PHP MySQL extensions. Also, the php.net Windows team is using mysqlnd for the official PHP Windows distribution since mysqlnd became available in PHP 5.3. Advantages of using mysqlnd. The mysqlnd library is highly optimized for and tightly integrated into PHP.
New project: downloads will be posted here as soon as they are available.For the latest development news, see the Development page for this driver.
You can find current releases on Github.
Following table shows only archived versions.
Release Date | File Name | Size | Description |
---|---|---|---|
2020-08-13 | php-7.4.3-interbase-1.1.0-beta-linux-x64.tar.gz (for PHP 7.4) | 180Kb | Linux x64 (Beta boolean support) |
2020-08-13 | php-7.4.0-interbase-1.1.0-beta-win64.zip (for PHP 7.4) | 70Kb | Windows x64 (Beta boolean support) |
2020-08-13 | php-7.4.0-interbase-1.1.0-beta-win32.zip (for PHP 7.4) | 61Kb | Windows x86 (Beta boolean support) |
2020-08-17 | php-7.3.21-interbase-1.1.0-beta-linux-x64.tar.gz (for PHP 7.3) | 182Kb | Linux x64 (Beta boolean support) |
2020-08-13 | php-7.3.0-interbase-1.1.0-beta-win64.zip (for PHP 7.3) | 71Kb | Windows x64 (Beta boolean support) |
2020-08-13 | php-7.3.0-interbase-1.1.0-beta-win32.zip (for PHP 7.3) | 62Kb | Windows x86 (Beta boolean support) |
2019-12-01 | php-7.4.0-interbase-linux-x64.gz (for PHP 7.4) | 148Kb | Linux |
2019-12-16 | php-7.4.0-interbase-win32.zip (for PHP 7.4) | 61Kb | Windows x86 |
2019-12-16 | php-7.4.0-interbase-win64.zip (for PHP 7.4) | 71Kb | Windows x64 |
2019-05-31 | php-7.3.0-interbase-linux.tar.gz (for PHP 7.3) | 123Kb | Linux |
2019-05-16 | php-7.3.0-interbase-win32.zip (for PHP 7.3) | 61Kb | Windows x86 |
2019-05-16 | php-7.3.0-interbase-win64.zip (for PHP 7.3) | 70Kb | Windows x64 |
In this article I’ll show you how to install the Microsoft SQL Server Driver for PHP 7+. This makes the use of an SQL Server database back-end for your PHP website easy. If you want to communicatie with SQL Server using PHP you need to rely on some additional software and PHP extensions. This post walks you through the steps necessary to install the SQL Server driver and SQLSRV extension for PHP 7+, on Windows ServerIIS of course.
How to install Microsoft’s SQL Server Driver for PHP 7+#
To let PHP (PHP 7.0, PHP 7.1, PHP 7.2) communicate with an SQL Server database you need additional software: ODBC drivers, and the PHP SQLSRV extension. You have to use the SQLSRV API functions to connect to an MS SQL Server database from PHP. Or PDO of course…
First you need to download all of this. Please note some version numbers might be outdated.
Required software to install PHP 7 and SQL Server SQLSRV PHP extension#
You need the following software, go ahead and download:
- Microsoft® ODBC Driver
11,13,13.1, 17 for SQL Server® – Windows: https://www.microsoft.com/en-us/download/details.aspx?id=56567. The Microsoft ODBC Driver for SQL Server provides native connectivity from Windows to Microsoft SQL Server and Windows Azure SQL Database. - Microsoft Drivers for PHP 7 for SQL Server: https://github.com/Azure/msphpsql/tree/PHP-7.0. The Microsoft Drivers for PHP for SQL Server are PHP extensions that allow for the reading and writing of SQL Server data from within PHP scripts.
- Check out the Microsoft Drivers for PHP for SQL Server System Requirements.
Note: on Windows, download the DLLs from SQLSRV or PDO_SQLSRV PECL repository (source). To download and install the most up-to-date ODBC driver version, read Microsoft Docs Microsoft ODBC Driver for SQL Server on Windows and Download ODBC Driver for SQL Server.
SQL Server Native Client (SNAC) 2012#
Since the release of ODBC Driver 11 for SQL Server you no longer have to install SQL Server Native Client – or SNAC – 2012.
The Microsoft SQLNCli team blog states:
Microsoft is adopting ODBC as the de-facto standard for native access to SQL Server and Windows Azure SQL Database. We have provided longstanding support for ODBC on Windows and, in the SQL Server 2012 timeframe, released support for ODBC on Linux (Red Hat Enterprise Linux 5 and 6, and SUSE Enterprise Linux). Microsoft is aligning and renaming the previous ODBC drivers as follows:
This change will result in our ODBC drivers for Windows and Linux being better aligned going forward. We hope that this change makes it easier for you to find the right driver for your needs and makes it easier to stay informed of new releases. Today’s availability marks the first combined release for your use.
And the Database Engine Developer Documentation states:
There are no more updates to the ODBC driver in SQL Server Native Client. The successor to the ODBC driver in SQL Server Native Client, called the Microsoft ODBC Driver 11 for SQL Server on Windows, is installed with SQL Server 2014. For more information about the Microsoft ODBC Driver 11 for SQL Server on Windows, see Microsoft ODBC Driver 11 for SQL Server – Windows
Visual Studio C++ 2015 for PHP 7 on Windows Server IIS#
To install PHP 7, you need to have Visual Studio C++ 2015, or VC14, installed too. Download and install Visual C++ Redistributable for Visual Studio 2015 if you haven’t done so.
After you’ve downloaded and extracted the software, you need to install it all.
American Meadow's EC is located in Oakland Meadows. (a world I built) We have been working on fully moving there since the beginning of August. We were located in Appaloosa Plains but we were happy to move to a bigger lot. Hanoverian maresamerican meadows equestrian center. Powered by Create your own unique website with customizable templates.
Install ODBC Driver 11, 13, 13.1, 17 for SQL Server
To install the ODBC Driver, in your cmd command or PowerShell prompt, simply type:
Install Microsoft Drivers for PHP 7 for SQL Server
This isn’t really an installation, just download the msphpsql-PHP-7.0 zipfile from Github and unzip it. Within the archive you’ll find the folder msphpsql-PHP-7.0/binaries/<x64|x86>/ and two .dll files: php_sqlsrv_7_nts.dll
and php_sqlsrv_7_ts.dll
.
Pick the one you need for your IIS hosting environment, and copy the file to your PHP ext directory:
To enable the SQLSRV extension in PHP, add to your php.ini
file:
Php Driver Sql Server
Install Visual Studio C++ 2015
If you haven’t installed Visual C++ Redistributable for Visual Studio 2015 yet, install both .msi
files. PowerShell example:
Once everything is installed, the SQLSRV extension for PHP to SQL Server communication is available to your PHP scripts. We need to verify everything is in working condition.
Important: various software requires various Visual Studio Runtime versions (Microsoft Visual C++ Redistributable). I normally install them all: Microsoft Visual C++ 2010 (Service Pack 1) Redistributable, Visual C++ Redistributable for Visual Studio 2012 Update 4, Visual C++ Redistributable Packages for Visual Studio 2013, Microsoft Visual C++ 2015 Redistributable Update 3 and Microsoft Visual C++ Redistributable for Visual Studio 2017.
Test SQLSRV extension and ODBC Driver 11/13/13.1/17 for SQL Server with PHP#
The best way (in my opinion) for you to test whether everything in PHP works correctly is on the command line. Really, executing PHP on the prompt is easier than browsing to your phpinfo()
script, but of course, you’re free to do so – verify the extension is loaded.
Just run php-cgi.exe
with some parameters, like -v
to print out the version:
If something is wrong in your PHP configuration, an application crash notification pops up.
Jdbc Driver Sql Server
Got WinCache installed and available through a second php.ini
file and FastCgi handler (you followed my how to install PHP and Wincache on IIS article ;-) ), test that one too:
Sql Server Driver Download
SQLSRV for PHP 7 test script: Connect to an SQL Server with PHP
Verify everything is working correctly with a test script. I always use a script like the one below to verify the PHP connection with my SQL Server database, and that it’s all working:
Sql Native Driver Download
If everything went OK, all available SQL Server tables in your SQL database are printed.