I am trying to connect to a Microsoft SQL server database using PHP 5.6 and am getting the error "could not find driver".
I am initially attempting to use PDO but I could use the procedural version if necessary.
I have downloaded the SQL server PHP driver and placed it in the ext folder in my PHP installation.
I have also specified the extension in php.ini.
My web server is IIS 7.
My platform is Windows 7 Professional (the same box for both the database and the web servers).
PHP is executed correctly by IIS.
I think I must be missing something but can't find out what.
I would appreciate any pointers to what I might have missed or even a tutorial on how to combine the various technologies I have chosen.
I'm sure that someone must have succeeded in doing this.

Does running
php -m
on the command line show the moduleas enabled?
How about phpinfo()?
Which module are you using: pdo_mssql or sqlsrv?

I had some issues a few months back with pdo_mssql and but right now I can't remember what I did to fix it. I'll get back to you if I remember.

Hi. Thank you for the replies. I think I have resolved my initial problem... well I've got to the next error message anyway. I did not realise that I had installed PHP 5.6 with a thread-safe dll, which meant that I needed to enable to relevant thread-safe sql server driver for my version of PHP (5.6).
I was side-tracked by reading somewhere that I needed to use the non-thread-safe driver if I was connecting to a Microsoft SQL Server, so I hadn't even attempted to enable the thread-safe drivers in php.
Remember. If you've got PHP5ts.dll in your PHP directory, you should use the two drivers (php_pdo_sqlsrv_56_ts.dll, php_sqlsrv_56_ts.dll).
The pdo_sqlsrv option is now showing as enabled when I use phpinfo().

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.