How to Install and Run ThinkPHP 8.x on PHP 8.0 – Step‑by‑Step Guide

This guide explains what ThinkPHP is, how to install the framework with Composer, configure the debug mode, run a test server, view console output in the browser, and outlines the complete request‑handling flow from entry point to controller execution.

Open Source Tech Hub
Open Source Tech Hub
Open Source Tech Hub
How to Install and Run ThinkPHP 8.x on PHP 8.0 – Step‑by‑Step Guide

Overview

ThinkPHP is a lightweight, open‑source PHP framework released under the Apache‑2.0 license. ThinkPHP 8.x runs on PHP 8.0 and is a refactored version of the 6.1 codebase.

Installation

composer create-project topthink/think tp

The created directory (default tp) becomes the application root and can be renamed.

Enable debug mode

Set the environment variable APP_DEBUG=true in the project root .env file during development. In production set it to false.

APP_DEBUG = true

Run the built‑in server

Start the development server with: php think run To bind a custom port, use the -p option, e.g.:

php think run -p 8289

Trace output to the browser console

Configure the trace service to use the console driver: 'type' => 'console', Then open http://127.0.0.1:8289/ in a browser. The console will show request timing, memory usage, query count, etc.

ThinkPHP console output
ThinkPHP console output

Sample console log

请求信息 2025-05-23 08:53:06 HTTP/1.1 GET : http://127.0.0.1:8289/
(index): 5 运行时间 0.877023s [ 吞吐率:1.14req/s ] 内存消耗:74.30kb 文件加载:106
(index): 6 查询信息 0 queries
(index): 7 缓存信息 0 reads, 0 writes

Framework bootstrap flow

ThinkPHP 8 follows a deterministic bootstrap sequence:

Entry file public/index.php is executed.

Composer autoloader loads all dependencies.

Framework core think\App is instantiated.

All service providers (system and custom) are registered.

Configuration files and environment variables are loaded.

Router parses the incoming request and determines the target controller.

The resolved controller (and its view) runs business logic and returns a response.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

BackendPHPInstallationFrameworkThinkPHP
Open Source Tech Hub
Written by

Open Source Tech Hub

Sharing cutting-edge internet technologies and practical AI resources.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.