Detailed description of the. env file configuration tutorial of laravel framework-php Tutorial

Source: Internet
Author: User
In earlier versions, Laravel used the php file in the config folder to complete the configuration required for the project. later, it used. env to place some configurations from about 5. The following article describes the configuration of the. env file of laravel, a PHP Framework. For more information, see. In earlier versions, Laravel used the php file in the config folder to complete the configuration required for the project. later, it used. env to place some configurations from about 5. The following article describes the configuration of the. env file of laravel, a PHP Framework. For more information, see.

Preface

We should all know that when using the laravel framework to develop PHP programs, the framework is configured. the env file is crucial. you need to configure the database, database users, and cache for this file. let's take a look at the detailed configuration tutorial.

1. configure APP_KEY

The laravel framework hardcoded symmetric encryption keys in the. env configuration file by default. The same APP_KEY is not required in the development and production environments and must be strictly prohibited.
Run in projectphp artisan key:generateThe key is automatically generated in the. env file.

 APP_KEY=Li0zqXhuxOlnsMtG90UsU**********

2. configure database and database users

(1) create a database

Use commandsmysql < init_db.sql Execute scripts to create a database

(2) create a database user

Use commandsmysql < create_usr.sqlRun the script to create a user

CREATE two users here. one cloudlab_dev user has the Insert, Select, Delete, Update, and CREATE permissions.

A cloudlab_dba has the Insert, Select, Delete, Update, ALTER, CREATE, DROP, INDEX, and LOCK permissions.

Generally, cloudlab_dev is used, and cloudlab_dba is used for table creation.

Result:

DB_HOST=127.0.0.1DB_DATABASE=cloudlabDB_USERNAME=cloudlab-devDB_PASSWORD=cloudla******DB_USERNAME_DBA=cloudlab-dbaDB_PASSWORD_DBA=cloud*******

The above is the detailed description of the. env file configuration tutorial of the laravel framework. For more information, see other related articles in the first PHP community!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.