Yii is installed under Windows (by composer mode)

Source: Internet
Author: User
Tags hhvm nginx server shared hosting yii

Composer Installation:

(Composer is not a package manager, it is just a dependency management tool.) It involves "packages" and "libraries", but it is managed on a per-project basis and installed in a directory of your project (for example, vendor). By default it will not install anything globally. Note: PHP version requires support in version 5.3 and above! )

In Windows, you need to download and run Composer-setup.exe.

Note: The PHP file location (eg:d:\phpstudy\php\php-5.5.38\php.exe) may be required for the selection to run during installation

The php_openssl.dll extension needs to be opened in the php.ini configuration file

Installing YII
Composer Create-project--prefer-dist Yiisoft/yii2-app-basic basic

This will basic install the most recent stable version of the Yii application template in a directory named (the project code will exist in this directory). If you want, you can choose a different directory name.

Tip: If you want to install the latest development version of YII, you can use the following command instead, which adds a stability option:

Composer Create-project--prefer-dist--stability=dev yiisoft/yii2-app-basic Basic
Installing Assets

Yii relies on Bower and/or NPM packages to install asset (CSS and JavaScript) libraries. It uses composer to get these libraries, allowing both PHP and Css/javascript package versions to be parsed at the same time. This can be achieved by using the asset-packagist.org or composer asset plugin. For more details, see the Assets documentation.

You may want to manage your assets with a local BOWER/NPM client, use a CDN, or completely avoid assets installations. To prevent installation of assets through Composer, add the following lines to your ' Composer.json ':

"Replace": {    "Bower-asset/jquery":">=1.11.0",    "Bower-asset/inputmask":">=3.2.0",    "Bower-asset/punycode":">=1.3.0",    "Bower-asset/yii2-pjax":">=2.0.0"},

Note: in the case of Composer bypass assets installation, you are responsible for assets installation and resolving version conflicts. There may be inconsistencies between the assets files that are prepared from different extensions.

Verifying the results of the installation

When the installation is complete, or configure your Web server (see the following article) or use the built-in Web server, when in the project web directory you can pass the following command:

PHP Yii serve

Note: By default, Https-server listens to 8080. However, if this port is already in use or you want to run multiple applications in this way, you can specify which ports to use. Add only the--port parameter:

PHP yii serve--port=8888

Once the installation is complete, you can use the browser to access the newly installed YII application via the following URL:

http://localhost:8080/

Configure the WEB server

Applications installed through the above methods are Windows,max OS X, Apache http server in Linux or Nginx HTTP server and PHP version 5.4 or higher can be run directly. YII 2.0 is also compatible with Facebook's HHVM, as HHVM and standard PHP are slightly different in border cases, and need to be handled slightly when using HHVM.

On a production server, you might want to configure the server so that applications can be accessed through URLs http://www.example.com/index.php instead of http://www.example.com/basic/web/index.php . This configuration requires that the document root of the WEB server be pointed to the basic/web directory. You may also want to hide the URL index.php , details in the URL parsing and generation chapter, you will learn how to configure Apache or Nginx server to achieve these goals.

Info: Set Basic/web to the document root, which prevents end users from accessing private application code and sensitive data files in Basic/web adjacent directories. Banning access to other directories is a good security improvement.

Info: If your application will run in a shared virtual host environment in the future without modifying the permissions of its WEB server configuration, you can still improve security by adjusting the structure of your app. Please refer to the shared hosting environment chapter for details.

Info: If you run a YII application behind a reverse proxy, you may need to configure Trusted proxies and headers in the request component.

Reference Address:

Http://www.yiichina.com/doc/guide/2.0/start-installation#installing-via-composer

Https://jingyan.baidu.com/article/c45ad29c2eb01d051753e2be.html

Yii is installed under Windows (by composer mode)

Related Article

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.