Connect Yii2 with database in SQLite

0

I'm trying to connect my application in Yii2 with a BD in Yii2 so far this is the configuration I have in my .db file

return [
             'class' => 'yii\db\Connection',
            'dsn' => 'sqlite:' . __DIR__  .'/../../softwareoperacional.db',
            ];
    
asked by Sebastian Salazar 23.02.2018 в 06:27
source

1 answer

0

about your configuration file main.php or main-local.php the configuration to be handled would be

return [
// ...
'components' => [
        .....
        'db' => [
            'class' => 'yii\db\Connection',
            'dsn' => 'sqlite:/miDB.db',
        ],
        .....
    ],
];

the database file must have read and write permissions to perform necessary operations such as SELECT e INSERT , you can find more information in the following link link

Note that you must have the sqlite extension installed to work.

    
answered by 23.02.2018 в 06:45