index.php missing in Yii2 advanced

I’ve just installed Yii2 advanced via composer and this is the structure of web folders:

frontend/web:

-assets

-css

-favicon.ico

-robots.txt

backend/web:

-assets

-css

-favicon.ico

-robots.txt

Where are the index.php files in yii2 advanced???

P.D. I also installed the yii2 basic and it has the index.php files.

I’ve just checked this article but it doesn’t say anything to solve my problem. I executed the init command but it doesn’t work. Moreover there is no such common/config/main-local.php file in the yii2 structure.

Because you have not executed the init command which is described there.

Thanks. It wasn’t working because I typed “init” instead of “php init”.

Now I have another problem: When I type “yii migrate” it says: “No command ‘yii’ found”

If it’s Windows just use “php yii” (if you have got PHP in PATH).

Edit: I see it is.

I’m using Linux Mint. I typed “php yii migrate” and it worked, but I got this message:

[b]Exception ‘yii\db\Exception’ with message 'SQLSTATE[HY000] [2002] Can’t connect to local MySQL server through socket '/v

ar/run/mysqld/mysqld.sock’ (2)’[/b]

I’m sure that MySQL server is running on 3306, becuase PHPMyAdmin works well.

Is everything fine with db config in common/config/main-local.php?

Yes, I think it is fine:


<?php

return [

    'components' => [

        'db' => [

            'class' => 'yii\db\Connection',

            'dsn' => 'mysql:host=localhost;dbname=yii2advanced',

            'username' => '',

            'password' => '',

            'charset' => 'utf8',

        ],

        'mailer' => [

            'class' => 'yii\swiftmailer\Mailer',

            'viewPath' => '@common/mail',

            // send all mails to a file by default. You have to set

            // 'useFileTransport' to false and configure a transport

            // for the mailer to send real emails.

            'useFileTransport' => true,

        ],

    ],

];

(I already created the yii2advanced database)

  1. Make sure again if mysql is running.

  2. Change localhost to 127.0.0.1.

  3. Use root as the username.

It worked! I had to change localhost to 127.0.0.1 and use root as the username.

Great!

I hope to see you helping Yii 2 users as often as you did for Yii 1.1 fans at this forum ;)