Multiple database connections and Yii 2.0

First you need to configure your databases like below: return [ ‘components’ => [ ‘db1’ => [ ‘class’ => ‘yii\db\Connection’, ‘dsn’ => ‘mysql:host=localhost;dbname=db1name’, //maybe other dbms such as psql,… ‘username’ => ‘db1username’, ‘password’ => ‘db1password’, ], ‘db2’ => [ ‘class’ => ‘yii\db\Connection’, ‘dsn’ => ‘mysql:host=localhost;dbname=db2name’, // Maybe other DBMS such as psql (PostgreSQL),… ‘username’ => … Read more

Enable clean URL in Yii2

I got it working in yii2. Enable mod_rewrite for Apache. For basic template do the following: Create a .htaccess file in web folder and add this RewriteEngine on # If a directory or a file exists, use it directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # Otherwise forward it to index.php RewriteRule . index.php Then … Read more