Yii2.x app initialization tool-php Tutorial

Source: Internet
Author: User
Description of Yii2.x app initialization tool

This tool is an official tool, but it has been adjusted according to the [LNMP] Yii 2.x application directory structure (based on the official Advanced version). Therefore, you must follow the directory specifications when using this tool.

Function
  1. Application running environment check
  2. Composer tool, the library code file is in/../verdor/
  3. Quick application initialization, including index file deployment in the web Directory, directory read/write permission settings, file read/write file settings, configuration file initialization settings, and file soft chain settings
  4. Switch the running mode of the application, including the development mode and production mode (configurable and scalable)
  5. Deployment of other template files in different modes (for example, files such as robots.txt)
Tool structure
Requirements. php runtime environment check tool (web tool) composer. phar composer run the script composer. json composer code source configuration composer. lock composer lock file init initialization tool script init. bat initialization tool script (window) environments/application template file
Environments/

Index. php

Return [// Development mode 'development' => [// template code directory 'path' => 'dev ', // Set the readable directory 'setwritable' => ['backend/assets', 'frontend/assets', 'runtime', 'data',], // Set the executable file 'setexecutable' => ['console/yii', 'console/yii. bat ', 'tests/codeception/bin/yii',], // Set the cookie key 'setcookievalidationkey' => ['config/backend/main. php', 'config/frontend/main. php ',], // Soft link settings 'createsymline' => ['index. php '=>' frontend/index. php', 'index-test. php '=> 'frontend/index-test.php', 'robots' => 'frontend/robots', 'assets' => 'frontend/assets ', '/frontend/data' =>'/data', '/frontend/static' => '/static', '/backend/data' =>'/data ', '/backend/static' => '/static',], // The directory to be cleared before running 'setcleanpath' => ['frontend', 'backend',], // the user running the web program 'webuser' => 'nobody',],];
Dev

Template files in development mode

config/console/frontend/backend/
Prod

Template files in production mode

config/console/frontend/backend/
Tool running Configuration before running

Set the file to executable:

cd /path/tools/chmod u+x init composer.phar

Configure the actual path of the php command: starting with the init file

#! /Usr/local/php5.6.15/bin/php
 Use the composer tool
cd /path/tools/./composer.phar
Environment check tools

Http://xxx.xxx.xxx/tools/requirements.php

Initialization tool
cd /path/tools/./init
Running effect Environment check (Yii 2.x)

Result of successful check

Initialization tool

Run

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.