所以我得到了项目。它已经完成并且它应该可以工作,现在我正试图运行它。 它使用PHP 5.6和Codeigniter,DB是MSSQL11.SQLEXPRESS。我在XAMPP上运行项目 这是我的db config:
$db['default']['hostname'] = '127.0.0.1';
$db['default']['port'] = '1433';
$db['default']['username'] = 'user';
$db['default']['password'] = 'password1234';
$db['default']['database'] = 'DataBase004';
$db['default']['dbdriver'] = strncasecmp(PHP_OS, 'WIN', 3) == 0 ? 'sqlsrv' : 'mssql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = FALSE;
$db['default']['db_debug'] = FALSE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
看起来是正确的,但在日志中我总是会遇到如下错误:
ERROR - 2016-08-26 00:55:22 --> Unable to connect to the database
ERROR - 2016-08-26 00:55:22 --> Unable to connect to the database
ERROR - 2016-08-26 00:55:22 --> Severity: Warning --> sqlsrv_query() expects parameter 1 to be resource, boolean given C:\xampp\htdocs\prompt-web\src\resources\system\database\drivers\sqlsrv\sqlsrv_driver.php 152
ERROR - 2016-08-26 00:55:22 --> Severity: Warning --> sqlsrv_query() expects parameter 1 to be resource, boolean given C:\xampp\htdocs\prompt-web\src\resources\system\database\drivers\sqlsrv\sqlsrv_driver.php 152
ERROR - 2016-08-26 00:55:22 --> Unable to connect to the database
ERROR - 2016-08-26 00:55:22 --> Severity: Warning --> sqlsrv_query() expects parameter 1 to be resource, boolean given C:\xampp\htdocs\prompt-web\src\resources\system\database\drivers\sqlsrv\sqlsrv_driver.php 152
ERROR - 2016-08-26 00:55:22 --> Severity: Warning --> sqlsrv_query() expects parameter 1 to be resource, boolean given C:\xampp\htdocs\prompt-web\src\resources\system\database\drivers\sqlsrv\sqlsrv_driver.php 152
这是来自服务器的页面:
在php / ext中我得到了驱动程序:
php_pdo_sqlsrv_56_ts.dll
和php_sqlsrv_56_ts.dll
我把它添加到php.ini:
extension=php_sqlsrv_56_ts.dll
extension=php_pdo_sqlsrv_56_ts.dll
我应该做其他事吗? 我试图以多种不同的方式解决它。