- Edited
Hello all
Spent 3 weeks now trying to get PHP to talk to MS SQL Server without success.
I know it used to years ago with earlier versions of IIS Express and PHP7. Had no issues back then.
Recently decided to pick up PHP again.
I started with PHP v 8.2 and the corresponding "82" drivers (ts and nts) but couldn't get them to load.
So went backwards to PHP 7.4 and associated "7"" drivers which at least appear to be loading.
Currently all versions of PHP work fine under IIS Express with or without MySQL data backend.
And IIS Express connects to MS SQL Server no problem with .Net webistes.
This makes me believe it's not an IIS problem.
There is no reference to SQL Server in the phpinfo() output even though the drivers are
included in the PHP.ini file.
Any advise as to what I am missing here would be appreciated.
I have listed below as much detail as I can for your information.
If you need any more just ask.
Thanks
Ray Pooley
Windows 10 version 21H2 (OD Build 19044, 2846)
IIS Express version (10.0.19041.1)
SQL Server Management Studio version 18.9.1
MySql version 8.01
PHP version 7.4.33 NTS x64 (PHP7.dll)
The statement :
$conn = new PDO("sqlsrv:server=$serverName ; Database = $database", $uid, $pwd);
throws an exception message : "could not find driver"
Note that if I use $conn = sqlsrv_connect($serverName, $connectionInfo);
I get error "Call to undefined function sqlsrv_connect()"
All files enabled in PHP Manager are present in the PHP/ext folder desinated in the PHP.ini file.
PHP.ini extensions
[PHP_CURL]
extension=php_curl.dll
[PHP_GD2]
extension=php_gd2.dll
[PHP_GETTEXT]
extension=php_gettext.dll
[PHP_MYSQLI]
extension=php_mysqli.dll
[PHP_MBSTRING]
extension=php_mbstring.dll
[PHP_OPENSSL]
extension=php_openssl.dll
[PHP_SOAP]
extension=php_soap.dll
[PHP_XMLRPC]
extension=php_xmlrpc.dll
[PHP_PDO_SQLITE]
extension=php_pdo_sqlite.dll
[PHP_ODBC]
extension=php_odbc.dll
[PHP_SQLITE3]
extension=php_sqlite3.dll
[PHP_PDO_SQLSRV_7_NTS_X64]
extension=php_pdo_sqlsrv_7_nts_x64.dll
[PHP_SQLSRV_7_NTS_X64]
extension=php_sqlsrv_7_nts_x64.dll
[PHP_PDO_ODBC]
extension=php_pdo_odbc.dll
[PHP_PDO]
extension=php_pdo.dll