数据库连接 SQLSRV

Database connect SQLSRV

我正在尝试将 codeigniter 连接到 sql 服务器 2008。我的 PHP 版本 PHP Version 5.6.14

我收到这个错误。在PHP_ERROR_LOG

[04-May-2016 04:19:50 UTC] PHP Warning:  PHP Startup: pdo_sqlsrv: Unable to initialize module
Module compiled with module API=20100525
PHP    compiled with module API=20131226
These options need to match
 in Unknown on line 0

[04-May-2016 04:19:50 UTC] PHP Warning:  PHP Startup: sqlsrv: Unable to initialize module
Module compiled with module API=20100525
PHP    compiled with module API=20131226
These options need to match
 in Unknown on line 0

[04-May-2016 04:19:51 UTC] PHP Warning:  PHP Startup: pdo_sqlsrv: Unable to initialize module
Module compiled with module API=20100525
PHP    compiled with module API=20131226
These options need to match
 in Unknown on line 0

[04-May-2016 04:19:51 UTC] PHP Warning:  PHP Startup: sqlsrv: Unable to initialize module
Module compiled with module API=20100525
PHP    compiled with module API=20131226
These options need to match
 in Unknown on line 0

我将此 php_sqlsrv_56_nts.dll & php_sqlsrv_56_ts.dll 复制到 ext 文件夹。

任何帮助将不胜感激

你不必同时使用这两个文件,末尾带有ts的文件意味着线程安全,你可以使用它。此外,您还需要将以下行添加到 php.ini 文件中:

extension=php_sqlsrv_56_ts.dll

干杯!