调用xampp中未定义的函数sqlsrv_connect() [英] Call to undefined function sqlsrv_connect() in xampp
问题描述
当我试图在codeigniter连接sqlsrv服务器,我得到这个错误消息。
When I tried to connect sqlsrv server in codeigniter, I got this error message.
调用xampp中的未定义函数sqlsrv_connect
Call to undefined function sqlsrv_connect() in xampp
以下是来自database.php的代码
Below is codes from database.php
$db['default'] = array(
'dsn' => '',
'hostname' => 'MainDS\WTInfoUnit',
'username' => 'sa',
'password' => 'crafter',
'database' => 'BioStar_DoorLog',
'dbdriver' => 'sqlsrv',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
推荐答案
为了能够使用 sqlsrv _ * 函数,有PHP的Microsoft SQL Server驱动程序。
In order to be able to use sqlsrv_* functions, you need to have the Microsoft SQL Server drivers for PHP. SQL Server drivers are not included by default in PHP Package, and developers need to add them to their php installations.
按照Microsoft的指南为PHP安装SQL Server驱动程序:
Follow Microsoft guide for installing SQL Server Driver for PHP:
https://msdn.microsoft.com/en-us/library/cc296203%28v=sql.105%29.aspx
您可以从Microsoft网站下载驱动程序:
You can download the drivers from Microsoft site:
https://www.microsoft.com/zh-TW/download/details.aspx?id=20098
让您在php.ini中 php_sqlsrv_YOUR_PHP_VERSION_ts.dll 的引用正确
Make you reference correct php_sqlsrv_YOUR_PHP_VERSION_ts.dll in your php.ini
- 谢谢
这篇关于调用xampp中未定义的函数sqlsrv_connect()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!