When cloning a Laravel app from Git repository to run on the server or local machine for the first time, it is necessary to run the following commands:
git clone <git repo>
cd <repo>
Install dependencies and change permission for storage directory
composer install
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
Then rename or copy .env.example
to .env
and generate a new key
cp .env.example .env
php artisan key:generate
Migrate the database after all necessary config information has been updated in the .env
file:
php artisan migrate