有没有办法使用 php 7.2 版在 codeigniter 3 和 sql 服务器之间建立连接
is there a way of creating a connection between codeigniter 3 and sql server using php version 7.2
我可以使用什么方法在 codeigniter 和 sql 服务器之间创建连接?
以下是我的连接方式,但似乎不起作用
$active_group = 'default'; $query_builder = TRUE; $db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'port' => '1433',
'username' => 'username',
'password' => '*****',
'database' => 'database_name',
'dbdriver' => 'mssql',
'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
);
连接没有建立,我不知道是什么问题
$active_group = 'default'; $query_builder = TRUE; $db['default'] = array(
'dsn' => '',
'hostname' => 'computer_name\SQLEXPRESS',
'port' => '1433',
'username' => 'username',
'password' => '*****',
'database' => 'database_name',
'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
);
首先我需要在我的电脑上安装 sql 服务器 php 驱动程序
安装扩展。 download driver然后提取然后复制php_pdo_sqlsrv_72_nts_x64.dll、php_pdo_sqlsrv_72_ts_x64.dll、php_sqlsrv_72_nts_x64.dll、php_sqlsrv_72_ts_x64.dll到/php/ext。然后在 /php/php.ini 中添加这些 extension=php_pdo_sqlsrv_72_nts_x64.dll extension=php_pdo_sqlsrv_72_ts_x64.dll extension=php_sqlsrv_72_nts_x64.dll extension=php_sqlsrv_72_ts_x64.dll
。重启阿帕奇
我可以使用什么方法在 codeigniter 和 sql 服务器之间创建连接? 以下是我的连接方式,但似乎不起作用
$active_group = 'default'; $query_builder = TRUE; $db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'port' => '1433',
'username' => 'username',
'password' => '*****',
'database' => 'database_name',
'dbdriver' => 'mssql',
'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
);
连接没有建立,我不知道是什么问题
$active_group = 'default'; $query_builder = TRUE; $db['default'] = array(
'dsn' => '',
'hostname' => 'computer_name\SQLEXPRESS',
'port' => '1433',
'username' => 'username',
'password' => '*****',
'database' => 'database_name',
'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
);
首先我需要在我的电脑上安装 sql 服务器 php 驱动程序
安装扩展。 download driver然后提取然后复制php_pdo_sqlsrv_72_nts_x64.dll、php_pdo_sqlsrv_72_ts_x64.dll、php_sqlsrv_72_nts_x64.dll、php_sqlsrv_72_ts_x64.dll到/php/ext。然后在 /php/php.ini 中添加这些 extension=php_pdo_sqlsrv_72_nts_x64.dll extension=php_pdo_sqlsrv_72_ts_x64.dll extension=php_sqlsrv_72_nts_x64.dll extension=php_sqlsrv_72_ts_x64.dll
。重启阿帕奇