YII2 framework (1) install Yii2 framework and yii2composer from scratch

Source: Internet
Author: User

YII2 framework (1) install Yii2 framework and yii2composer from scratch

Recently, I am studying PHP and I am looking for a quick-start framework to learn. ThinkPHP was recommended by the lecturer when watching the video of brothers. So I chose ThinkPHP to try it. It is difficult to get started with this framework and can quickly develop an application. Suitable for small-sized enterprise applications. Because it is developed by Chinese people, Chinese support is better. There are comprehensive documents, and the official website community is also active. Because all projects I use Oracle databases, I want to find a PHP framework that supports Oracle better, but the ThinkPHP framework does not support Oracle very well. So I changed the Yii framework to try Oracle Support.

The current stable version of The Yii framework is 1.1.14. Currently, version 2.0 is a test version. It took several days to learn how to create an application in yii1. There are not many documents about Yii. Most of them are in the original English version. However, Oracle is supported. AR technology is used. I recently read the Yii2 documentation. It includes the PHP namespace concept, Bootstrap, smarty, and many other useful functions. I made great progress than Yii1. Finally, I decided to study the Yii2 framework. Yii2 should be better based on its understanding of Yii1.

Today, I finally figured out how to install Yii2. For me, this is really a huge deal. The following describes how to install Composer and how to use Composer to install yii2.

Composer is a tool used in PHP to manage dependencies. You can declare the dependent external library (libraries) in your project. Composer will help you install these dependent library files.

Install Composer in Windows:
1. Download Composer

Download: https://getcomposer.org/download/

2. Enable openssl support for PHP

Modify D: \ WAMP \ bin \ php \ php5.4.12 configuration file php. ini

Remove comments;


3. Install Composer

The installation of "next" is complete.

After the installation is complete, you will be prompted to re-open the CMD command line.

Install the Yii2-advanced Template
1. Download The yii2-advanced Template

Download: http://www.yiiframework.com/download/

Decompress the package
D: \ WAMP \ www

Ii. installation through composer

Open CMD and jump to the directory
D: \ WAMP \ www \ advanced

We will generate an app named "yii2test.

Enter the following command:

Composer create-project -- prefer-dist -- stability = dev yiisoft/yii2-app-advanced ../yii2test

Wait... ... The following interface is displayed, indicating that the installation is successful.

3. initialize the project

Run the CMD command init.

Test installation result

Enter http: // localhost/yii2test/frontend/web/index. php in the address bar.

The following page is displayed:


Now that Yii2 is installed, I will follow up on the learning progress of PHP framework yii2.


Yii2 encountered the following error when using composer for installation ,......

You have not enabled mongodb extension in php ~~~~ It's okay with Composer.

Open your php. ini and enable mongodb extension (remove the previous)

Restart your server (apache, iis ...)

Try again.

I don't know if it's linux. Search for it.


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.