Prerequisites
- Apache Web Server
- PHP 5.4, 5.5, or 5.6
- These must be installed before starting (see figure ):
- ○ SQL Server 2012 Express
- ○ SQL Server 2012 R2 Native Client
- ○ Microsoft Visual C++ 2010 SP1 Redistributable Package (x86)
The figure above is taken from the Control Panel -> Programs and Featurs For PHP 5.x, obtain drivers at:
• https://www.microsoft.com/en-us/download/details.aspx?id=20098
Version support for PHP is as follows:
- Version 3.2 supports PHP 5.6, 5.5, and 5.4
- Version 3.1 supports PHP 5.5 and 5.4
- Version 3.0 supports PHP 5.4.NOTE:control panel -> programs and features
These instructions are for Apache web server, but if you use Microsoft's web server IIS, you must instead install the PHP drivers at http://www.iis.net/learn/application-frameworks/install-and-configure-php-on-iis/install- the-sql-server-driver-for-php
For Apache Web Server 5.4,5.5, 5.6:
- Download SQLSRV32.EXE
- Unpack it to your desired directory. This directory needs to be one that will be accessible to theApache Web Server. In my case, I installed XAMPP, used the defaults, and my directory will be C: \xampp\php
Setting Up Web Tools Page 1
\xampp\php
a. You will notice several new files that are of the form:
i. Php_[pdo or sqlsrv]_5x.dll, where x is 4, 5 or 6 (see next figure)
3. Open your php.ini file
Note: When you installed XAMPP, you got an XAMPP control panel. Use it! For example, you can open the XAMPP control panel, on the Apache line, select CONFIG, and from the drop down menu you can easily open several config files, such as php.ini discussed in the next steps. You can also define a default editor. I like Notepad++ which is available at https://notepad-plus-plus.org/download/v7.html.
- Locate the extension_dir variable
- Locate the Windows Extensions section for your version of PHP
- Copy your dll’s into the folder given by the “extension_dir” of php.ini
- Add the following two lines (see next figure) extension=php_sqlsrv_5x_nts.dll extension=php_sqlsrv_5x_ts.dll
In this example, I have PHP 5.5, so my php.ini file looks like this:
your php.ini file versions may be different.
4. Restart your Apache Web Server