I've been tasked with taking all of our MySQL databases and migrating them to SQL Server. In attempting to get PHP 5.3.24 to work with MSSQL, I've done the following:
Copied the non thread-safe drivers to /php/ext.
Updated my php.ini file to include the following two lines:
extension=php_pdo_sqlsrv_53_nts_vc9.dll;
extension=php_sqlsrv_53_nts_vc9.dll
Restarted IIS 7 running on Windows Server 2008 R2.
phpinfo shows sqlsrv under Registered PHP Streams, and sqlsrv also appears under PDO drivers and pdo_sqlsrv support shows as "enabled." Yet, when I try to connect via my application, I get the following:
Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in C:\inetpub\wwwroot\mystuff\myphpconnectfile.php
My connect string looks like this:
$con = new PDO("mssql:host=xxx.xxx.xxx.xxx,1433;dbname=mydb", "user", "pwd");
$con -> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
return($con);
Looks like it's finding the server okay, but not the PHP/PDO mssql drivers. What have I missed?
EDIT: Configure Command under phpinfo shows the lines "--without-mssql" "--without-pdo-mssql". I don't know where to go to change this, or if it's necessary.