Welcome Guest, Not a member yet? Register   Sign In
Migration from CI3 to CI4 - SQLServer
#1

I'm having difficulty configuring CI4 to connect to SQL Server. Undecided

I have the following configuration on CI3 that works perfectly:

PHP Code:
$db['ADMINBD04'] = array(
    
'dsn'    => '',
    
'hostname' => 'ADMINBD\NAME',
    
'username' => 'userci',
    
'password' => '#password123',
    
'database' => 'BASE',
    
'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
); 

I tried to replicate at CI without success.

.evn

Code:
database.default.hostname = ADMINBD\NAME
database.default.database = BASE
database.default.username = userci
database.default.password = #password123
database.default.DBDriver = SQLSRV
database.default.port = 1433

Or in the Configuration file.

PHP Code:
    public $default = [
        
'DSN'      => '',
        
'hostname' => 'ADMINBD\NAME',
        
'username' => 'userci',
        
'password' => '#password123',
        
'database' => 'BASE',
        
'DBDriver' => 'SQLSRV',
        
'DBPrefix' => '',
        
'pConnect' => false,
        
'DBDebug'  => (ENVIRONMENT !== 'production'),
        
'charset'  => 'utf8',
        
'DBCollat' => 'utf8_general_ci',
        
'swapPre'  => '',
        
'encrypt'  => false,
        
'compress' => false,
        
'strictOn' => false,
        
'failover' => [],
        
'port'     => 1433,
    ]; 

I don't know what I'm doing wrong, I thank you for your help. Huh
Reply
#2

I discovered the problem, the firewall of the connection of the new server with PHP8 raised by the infra was with the UDP protocol blocked.

After several tests comparing the old server with PHP7, we identified the problem.

But, again, I would like to congratulate you for your efforts to keep CodeIgniter simple and fantastic.
Reply
#3

Thank you for sharing your solution!
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply




Theme © iAndrew 2016 - Forum software by © MyBB