PHP instance-php framework laravel. env File Configuration Tutorial

Source: Internet
Author: User
Tags php framework
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

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.