The previous version of Laravel was to use the PHP file under the Config folder to complete the configuration required for the project, followed by the use of. Env to place the partial configuration from about 5 onwards. Then the following article mainly introduces you to the PHP framework laravel. env file configuration related information, required friends can refer to learning.
Objective
Everyone should know that when using the Laravel framework to develop PHP programs, the configuration framework of the. env file is critical, this file needs to configure the database, database users, and caching, and so on, let's take a look at the detailed configuration tutorial.
First, configure the App_key
The Laravel framework defaults to hard-coded symmetric encryption keys in the. env configuration file, and the development and production environments do not have to and should strictly prohibit the use of the same app_key
Running in the project php artisan key:generate
will automatically generate the key in the. env file.
app_key=li0zqxhuxolnsmtg90usu**********
II. configuration database and database user
(1) Create a database
Create a database using a command mysql < init_db.sql
execution script
(2) Create a database user
Create a user using a command mysql < create_usr.sql
execution script
Create two users here, one Cloudlab_dev user with insert,select,delete,update,create permissions
A CLOUDLAB_DBA has Insert,select,delete,update,alter,create,drop,index,lock permissions.
Use Cloudlab_dev users in general, use CLOUDLAB_DBA when working with tables
Results:
Db_host=127.0.0.1db_database=cloudlabdb_username=cloudlab-devdb_password=cloudla******db_username_dba= cloudlab-dbadb_password_dba=cloud*******
Summarize