I recently installed IIS, PHP 5.3.5 and MySQL, and had it all working.
I then has a requirement for MS SQL as well, and what I thought would be an easy task, is now driving me crazy and I can't figure out how to make it work.
According to php_info()
the MS SQL drivers aren't loading.
I downloaded php_mssql.dll
and enabled it in php.ini
but it didn't work. I found out that the new version of PHP uses a different dll. So I downloaded the new one, put that in the ext folder, and updated the php.ini
, but still no luck.
php_info()
still isn't showing the drivers are loaded.
I am about to uninstall IIS and PHP, and install Apache, which I've installed before.
This question is my last attempt, can anyone help?
This is a snippet from a customer FAQ I wrote up a wee while ago to help our dedicated hosting customers get PHP up and running with the MS SQL Drivers. It may duplicate some knowledge already imparted in the comments above, but it's completeness may also help others starting from scratch:
Note: Clearly the PHP version numbers have moved on a bit since I wrote this but the general principles still apply.
Installation Pre-requisite: The SQL Native Client is required for the Microsoft Drivers for PHP for SQL Server:
Download and install the Native Client driver that matches your system.
PHP MS SQL Drivers:
Download the Microsoft Drivers for PHP for SQL Server:
The file is a self-extracting executable so just use 7zip or WinRAR and extract the files to a folder of your choice. We now need to decide which driver to choose that matches your PHP installation.
PHP 5.3.5 comes in four different flavours:
To tell which version you have installed open the
snapshot.txt
file which lives in the same folder asphp.exe
,php-cgi.exe
etc. Don't use notepad.exe because the file uses just line feed (\n
) for line ends (unix format) at the start and notepad mangles these into a single line.In the file you will see a line (around line 6, or near the middle of line 1 of you did use notepad) starting with:
Build:
:This tells us what version of PHP you're running.
From the folder you extracted the MS SQL PHP drivers, choose the driver(s) that matches the version of PHP being used (if you're not using PDO then you don't need to copy the
php_pdo_
drivers):Assuming your PHP installation lives in
C:\PHP
, copy (DON'T MOVE) these files to yourC:\PHP\EXT
folder.Open
C:\PHP\PHP.INI
and locate theDynamic Extensions
part of the file and add:Finally, to be sure that PHP can find these extensions, ensure the
extension_dir
directive inC:\PHP\PHP.INI
is set toC:\PHP\EXT
:Restart IIS and call
phpinfo()
. If all is well you should see:And if you also loaded the PDO driver you should see:
The above mentioned:
what I found is incorrect.
Therefore, it is likely to be: