Home>Article>PHP Framework> How to install thinkphp

How to install thinkphp

藏色散人
藏色散人 Original
2019-06-29 13:23:59 11703browse

How to install thinkphp

Strictly speaking, ThinkPHP does not require an installation process. The installation mentioned here is actually putting the ThinkPHP framework into the WEB running environment (provided that your WEB running environment is OK), you can pass There are several ways to obtain and install ThinkPHP.

1. Official website download and installation

There are many ways to obtain ThinkPHP. The official website (http://thinkphp.cn) provides a stable version or a complete version with extensions download.

The downloaded version from the official website is not necessarily the latest version, the GIT version is the updated version.

2. Composer installation

ThinkPHP5 supports Composer installation. If Composer has not been installed, you can install it according to the method in Composer installation.

In Linux and Mac OS X you can run the following command:

curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer

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

If you encounter any problems or want to learn Composer more deeply, please refer to the Composer documentation (English), Composer Chinese.

If you have already installed Composer, please make sure you are using the latest version. You can use the composer self-update command to update Composer to the latest version.

Then on the command line, switch to your web root directory and execute the following command:

composer create-project topthink/think=5.0.* tp5 --prefer-dist

means to install the latest 5.0 version.

If an error message appears, please follow the prompts or refer to the Composer Chinese documentation.

If access to composer in China is slow, you can refer to the instructions here to use domestic mirrors

3. Git installation

If you don’t know much about it Composer or you feel that Composer is too slow, you can also use the git repository to install and update. ThinkPHP5.0 is split into multiple warehouses, mainly including:

Application projects: https://github.com/top-think /think

Core framework: https://github.com/top-think/framework

If your access to github is slow, you can consider the following two domestic GIT repositories:

[Code Cloud]

Application project: https://gitee.com/liu21st/thinkphp5

Core framework: https://gitee.com/ liu21st/framework.git

[Coding]

Application project: https://git.coding.net/liu21st/thinkphp5.git

Core framework: https://git.coding.net/liu21st/framework.git

The reason why it is designed to separate the application and core warehouse is to support Composer to update the core framework independently.

First clone and download the application project warehouse

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

Then switch to the tp5 directory, and then clone the core framework warehouse:

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

After the two warehouses are cloned, ThinkPHP5 is completed .0 Git download, if you need to update the core framework, you only need to switch to the thinkphp core directory, and then execute:

git pull https://github.com/top-think/framework

If you are not familiar with the git command line, you can use any GIT client to operate , will not be explained in detail here.

No matter how you obtain the ThinkPHP framework, you only need to do the last step to verify whether it is running normally.

Enter the address in the browser:

http://localhost/tp5/public/

If the browser output is as shown:

How to install thinkphp

Congratulations, it is now completed ThinkPHP5 installation!

If it is a mac or linux environment, please ensure that the runtime directory has writable permissions

If you cannot run normally and display the ThinkPHP welcome page, then please check your server environment:

PHP5.4 or above version (note: PHP5.4dev version and PHP6 are not supported)

Whether the WEB server starts normally

This article comes from the ThinkPHP framework technical article column://m.sbmmt.com/phpkj/thinkphp/

The above is the detailed content of How to install thinkphp. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn