Could Not Find Driver (SQL Server)
Could Not Find Driver (SQL Server)

Hi,
So this is not specific to DataTables but I am hoping someone out there can I help. I would really like to use DataTables but had given up the SQL Server Driver loading in my custom development and just started to use ODBC. I have tried the following things to get the SQL Server Driver to load successfully.
- I downloaded the correct driver from Microsoft based on my version of PHP.
- I placed the driver in the c:\php\ext folder (I also tried another folder just in case there was some permissions issues and configured php.ini to point there).
- I have tried putting an extension entry in php.ini file for the php_sqlsrv file, php_pdo_sqlsrv_83_nts_x64, and the php_pdo_sqlsrv_83_ts_x64. None of them load and I am running a 64 bit operating system.
- I have confirmed that my php.ini file is running in the c:\php\php.ini folder and that is where PHP is pointing to.
- I do have ODBC SQL Server Driver 17 and 18 on my machine.
DataTables warning: table id=example - An error occurred while connecting to the database ''. The error reported by the server was: could not find driver
I am out of ideas. Any suggestions would be greatly appreciated.
Thanks
Answers
The
could not find driver
part of the error message is coming from the PDOgetMessage
method. It suggests that thesqlsrv
driver is not installed in your PHP instance.I would suggest creating a file with simply
<?php phpinfo(); ?>
in it and then load it through your web-server / web-browser. Scroll down to thePDO
section and look for thePDO drivers
part. You should see something likedblib, mysql, pgsql, sqlite, sqlsrv
. If it isn't there, then the SQL Server driver isn't properly installed.I'm not sure I can help much on that front, other than to suggest checking the PHP start up logs to see if any errors are reported.
Allan