Purpose. We are in the process of converting over to a Linux-Apache stack after hosting our PHP site on a Windows-IIS stack. Locally, we will need to have an IIS and Apache stack running on our Windows machine for the time being until the conversion process is over. The local machine will continue to be Windows based.

After the compilation you can find your extension called phpinterbase.dll e.g. In C:php-sdkphpmastervc15x86php-srcRelease Replace x86 with x64 for Win64. About Firebird PHP driver. 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'.

Prerequisite. For full transparency, here are the “important” specs to my current workstation.

  • Windows 10
  • SQL (development database is not local but in Azure)
  • Maintain both IIS and Apache web servers.
  • Github Version Control
  • PHP 7.1
  • Composer Dependency Manager
  • Front-end Stack Includes: Grunt & Webpack, NPM

Step 1

Download

Because I’m trying to match our server as best as possible, I’ve opted to install XAMPP 7.1.22 which comes with PHP 7.1. https://www.apachefriends.org/xampp-files/7.0.32/xampp-win32-7.0.32-0-VC14-installer.exe

I’ve went with the default option and unchecked MySQL, Filezilla FTP Server, Mercury Mail Server, Tomcat, and Perl.

Driver

Step 2

Now I need it’s time to map the project url to the local IP address. This is done through the host file located in C:WindowsSystem32driversetc. Open it up in Notepad with “Run as Administrator.” An example entry is:

Php sql server example

127.0.0.1 mywebsite.local
127.0.0.1 www.mywebsite.local

Step 3

Now it’s time to clone down my repo from Github. This would be done inside C:xampphtdocs

Step 4

Next is to add entries in the C:xamppapacheconfextra httpd-vhosts.conf file. Add an example entry like:

<VirtualHost mywebsite.local>
DocumentRoot 'C:xampphtdocsmyproj'
</VirtualHost>

<VirtualHost www.mywebsite.local>
DocumentRoot 'C:xampphtdocsmyproj'
</VirtualHost>

Step 5

Install SQL Server drivers. They can be downloaded at. https://www.microsoft.com/en-us/download/details.aspx?id=57163 Once you download the drivers, extract them and install the one that matches the PHP version that you are using. I am installing PHP 7.1 so I’ll be using the SQLSRV drivers 7.1. Since this is a simple local Windows machine that doesn’t have multiple PHP threads running, I typically install the NTS (non-thread safe) drivers. The drivers goes into: C:xamppphpext

Step 6

Add driver references to PHP and other configurations through PHP.ini which can be access through the XAMPP control panel. A basic configuration I do is below, just make sure the SQLSRV dll(s) matches the filenames you placed in the ext folder in step 5:

extension=php_sqlsrv_71_ts_x86.dll
date.timezone = America/Chicago ;override accordingly
short_open_tag: On ;override accordingly

Step 7

Download the SQL Server ODBC drivers from here https://www.microsoft.com/en-in/download/details.aspx?id=36434 and install them.

Step 8

Testing time. I would create a simple test.php that has

echo phpinfo();

Php For Sql Server

and see if everything is installed correctly. You should see that SQLSRV is mentioned on the page. Start the webserver in XAMPP. At this time, if you have IIS on, you need to turn it off for all sites. This will prevent the two webservers from fighting over port 80.

http://localhost/test.php

Step 9 (Optional SSL Setup)

Sql Server Driver Download

If you see your website by going to the url you have set (e.g. mywebsite.local), then you’re all set. If you want to setup SSL, in httpd-ssl.conf which you can access from the Control Panel, look for this line:

<VirtualHost _default_:443>

and replace with

<VirtualHost _default_ *:443>

and make sure SSLEngine is on. And make sure the DocumentRoot points to your project’s directory. As for SSLCertificateFile and SSLCertificateKeyFile you may have to specify the absolute path:

Php Sql Driver Download 64-bit

Php Sql Driver Download

Ms Sql Odbc Driver Download

SSLCertificateFile 'C:/xampp/apache/conf/ssl.crt/server.crt'
SSLCertificateKeyFile 'C:/xampp/apache/conf/ssl.key/server.key'

Coments are closed
Scroll to top