Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
409 views
in Technique[技术] by (71.8m points)

php - Codeigniter: How to setup connection to a SQL server (2008)

I've spent many days on this task, and I can't see the end until now. In the past day I managed to install sqlsrv driver on my PHP environment successfully but now when I try to connect I get this message:

Unable to connect to your database server using the provided settings.

My settings in application/config/database.php are so defined:

$db['dbname']['hostname'] = "ENJ01SQLEXPRESS";
$db['dbname']['username'] = "user";
$db['dbname']['password'] = "password";
$db['dbname']['database'] = "dbname";
$db['dbname']['dbdriver'] = "sqlsrv";
$db['dbname']['dbprefix'] = "";
$db['dbname']['pconnect'] = TRUE;
$db['dbname']['db_debug'] = TRUE;
$db['dbname']['cache_on'] = FALSE;
$db['dbname']['cachedir'] = "";
$db['dbname']['char_set'] = "utf8";
$db['dbname']['dbcollat'] = "utf8_general_ci";
$db['dbname']['swap_pre'] = '';
$db['dbname']['autoinit'] = TRUE;
$db['dbname']['stricton'] = FALSE;

something wrong?

Here my environment configuration:

  • wampserver 2.4 x86
  • PHP 5.4.16
  • sqlsrv driver -> php_sqlsrv_54_ts.dll
  • Codeigniter 2.1.4
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I've had the same trouble you've had about a year ago. Have a look at the replies here, there are some great suggestions from people in there: CodeIgniter MSSQL connection

Also, a thread was posted a few days ago here: CI connect to SQL SERVER - check out my answer over there as well, since it's solved the problem for that particular developer.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...