I got errors when trying to connecting SQL server with yii2.
SQL Server and PHP code are in separated server.
The PHP environment is PHP 7.0.31 on Ubuntu 18.04.
And Database Server Environment is MS SQL SERVER v9.00.1399.06 on Window NT 6.1
And I installed the PDO Drive as following
apt install php7.0-sybase
The following is my main-local.php
'db' => [
'class' => 'yii\db\mssql\PDO',
'dsn' => 'sqlsrv:Server=xx.xx.xx.xx;Database=xxxx',
'username' => '<username>',
'password' => '<password>',
'charset' => 'utf8'
],
And i got the following error message.
Invalid Configuration – yii\base\InvalidConfigException
Missing required parameter "dsn" when instantiating "yii\db\mssql\PDO".
1. in /var/www/html/ms/vendor/yiisoft/yii2/di/Container.php at line 466
2. in /var/www/html/ms/vendor/yiisoft/yii2/di/Container.php at line 370 – yii\di\Container::resolveDependencies([yii\di\Instance, yii\di\Instance, yii\di\Instance, yii\di\Instance], ReflectionClass)
Seems related to class reflction but I have no idea on how to solve it.
Hope someone can give a help hand on this.