Windows installation and use of composer

This log records the installation and use of composer in the windows system.

A few days ago, Alibaba Cloud issued a notice saying that there are loopholes in the thinkphp5.0 and thinkphp5.1 frameworks. It is recommended to upgrade to the latest version to avoid attacks.

It has not been a day or two since my server has been attacked, and I am quite concerned about it.

Bugs are mainly in the underlying files of his framework.

My solution is to download the latest version of the framework from the official website and overwrite the underlying files on the server.

The problem is solved, but it is troublesome.

When I went to the official website to download the framework, I found the official website prompt:

Starting from version 5.1, the official website no longer provides a download version, please use Composer or git to install and update.

I have contacted git before. For articles about git, please click linux server to install git—centos7.4, git notes

git installation is simple

The installation needs to be divided into two steps. First, clone and download the application project warehouse

git clone https://github.com/top-think/think tp5

Then switch to the tp5 directory, and clone the core framework repository (note that the directory name should not be changed):

git clone https://github.com/top-think/framework thinkphp

Okay, let’s go back to the main character composer

The definition given by the official website is:

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

(1): Installation

Download the installation package, https://getcomposer.org/download/

Insert picture description here

Click on the .Exe file to install, all the way to the next step.

Open cmd, enter composer, the following figure appears, indicating that the installation is successful.

Insert picture description here

Switch domestic mirror:

composer config -g repo.packagist composer https://packagist.phpcomposer.com

Install thinkphp5.1

Go to the root directory of apache and execute the command.

F:
cd phpStudy_WWW
composer create-project topthink/think tp5 #tp5是你项目的名字,可随意更改

Insert picture description here

As shown in the figure above, the installation is successful.

The framework will be updated from time to time. The advantage of using composer to install is that you can use the command line to update it directly.

Enter the catalog

cd tp5
composer update topthink/framework

4.png

Since the installation of my framework is the latest, there is no update.

The update operation will delete the thinkphp directory and download and install the new version again, but it will not affect the application directory, so do not add any application code and class libraries to the core framework directory.

The directory where the installation and update commands are located is different, and the update must be performed under the root directory of your application

Have a good suggestion, please enter your comment below.

Welcome to personal blog
https://guanchao.site

Welcome to the Mini Program:
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_39708228/article/details/113034815