0

I have a live website built on yii2 framework and i want to test it localy using MAMP ,I created a new database named demoDB in phpmyadmin and import sql from live one, the updated database configuration inside the common/config/main.php file to the my local database authentication settings.

'db' => [
        'class' => 'yii\db\Connection',
        'dsn' => 'mysql:host=localhost;dbname=demoDB',
         'username' => 'demo',
        'password' => 'demopass111',
        'charset' => 'utf8',
    ],

but when i run MAMP the frontend only show directory like this

frontend path

I also tried to run command

php yii serve 

on project file but i got this error

Document root "/Applications/MAMP/htdocs/demoweb/console/web" does not exist.

anyone can help what I'm missing

1 Answer 1

1

you need to point your server document root to the right location.

in case of yii2 it has two separate folder called backend and frontend.

so if you try to serve your site using php built-in server you can use the following command from your project root to serve your site locally.

php -S localhost:3000 -t frontend/web/ for the frontend part

php -S localhost:8000 -t backend/web/ for the backend part

and your frontend and backend will be available at http://localhost:3000/ and http://localhost:8000/ respectively.

you can choose the port as your need. For example i use here 3000 and 8000.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.