时间:2025-6-14 作者:JackS·Zhao 分类: ThinkPHP
小皮面板->安装thinkphp安装稳定版
首先我安装了composer,因为初始源在githud.com 安装thinkphp 老是出错所以我换源改成阿里镜像源
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
如果你是第一次安装的话,在命令行下面,切换到你的WEB根目录下面并执行下面的命令:
composer create-project topthink/think tp.cn
还是出现下列问题
PS :\phpstudy_pro\WWW> composer create-project topthink/think tp.cn
Creating a "topthink/think" project at "./tp.cn"
Installing topthink/think (v8.1.2)
- Installing topthink/think (v8.1.2): Extracting archive
Created project in :\phpstudy_pro\WWW\tp.cn
Loading composer repositories with package information
Updating dependencies
Lock file operations: 18 installs, 0 updates, 0 removals
- Locking league/flysystem (1.1.10)
- Locking league/flysystem-cached-adapter (1.1.0)
- Locking league/mime-type-detection (1.15.0)
- Locking psr/cache (1.0.1)
- Locking psr/container (2.0.2)
- Locking psr/http-message (1.1)
- Locking psr/log (3.0.1)
- Locking psr/simple-cache (3.0.0)
- Locking symfony/polyfill-mbstring (v1.31.0)
- Locking symfony/var-dumper (v6.0.19)
- Locking topthink/framework (v8.1.2)
- Locking topthink/think-container (v3.0.1)
- Locking topthink/think-dumper (v1.0.5)
- Locking topthink/think-filesystem (v2.0.3)
- Locking topthink/think-helper (v3.1.11)
- Locking topthink/think-orm (v4.0.40)
- Locking topthink/think-trace (v1.6)
- Locking topthink/think-validate (v3.0.7)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 18 installs, 0 updates, 0 removals
- Downloading topthink/think-helper (v3.1.11)
- Downloading topthink/think-validate (v3.0.7)
- Downloading topthink/think-orm (v4.0.40)
- Downloading topthink/think-dumper (v1.0.5)
0/4 [>---------------------------] 0% Failed downloading topthink/think-helper, trying the next URL (404: The "https://mirrors.aliyun.com/composer/dists/topthink/think-helper/1d6ada9b9f3130046bf6922fe1bd159c8d88a33c.zip" file could not be downloaded (HTTP/2 404 ))
- Downloading topthink/think-helper (v3.1.11)
Failed downloading topthink/think-dumper, trying the next URL (404: The "https://mirrors.aliyun.com/composer/dists/topthink/think-dumper/eba662a1843d5db68059050c530f7d43287289fc.zip" file could not be downloaded (HTTP/2 404 ))
- Downloading topthink/think-dumper (v1.0.5)
Failed downloading topthink/think-validate, trying the next URL (404: The "https://mirrors.aliyun.com/composer/dists/topthink/think-validate/85063f6d4ef8ed122f17a36179dc3e0949b30988.zip" file could not be downloaded (HTTP/2 404 ))
- Downloading topthink/think-validate (v3.0.7)
Failed downloading topthink/think-orm, trying the next URL (404: The "https://mirrors.aliyun.com/composer/dists/topthink/think-orm/1637860ff736859058f0a5003c7cc719c2068dbc.zip" file could not be downloaded (HTTP/2 404 ))
- Downloading topthink/think-orm (v4.0.40)
Failed to download topthink/think-helper from dist: curl error 28 while downloading https://api.github.com/repos/top-think/think-helper/zipball/1d6ada9b9f3130046bf6922fe1bd159c8d88a33c: Failed to connect to api.github.com port 443: Timed out
Now trying to download from source
- Syncing topthink/think-helper (v3.1.11) into cache
Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos
When working with _public_ GitHub repositories only, head here to retrieve a token:
https://github.com/settings/tokens/new?scopes=&description=Composer+on+DESKTOP-HU9ULSO+2025-06-14+1754
This token will have read-only permission for public information only.
When you need to access _private_ GitHub repositories as well, go to:
https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+DESKTOP-HU9ULSO+2025-06-14+1754
Note that such tokens have broad read/write permissions on your behalf, even if not needed by Composer.
Tokens will be stored in plain text in "C:/Users/DELL/AppData/Roaming/Composer/auth.json" for future use by Composer.
For additional information, check https://getcomposer.org/doc/articles/authentication-for-private-packages.md#github-oauth
Token (hidden):
我关断更换腾讯镜像源
composer config -g repo.packagist composer https://mirrors.cloud.tencent.com/composer/
OK重新执行thinkphp安装语句
composer create-project topthink/think tp.cn
嗯这次终于无措安装过来了。
在thinkphp本地安装二开过程中要注意两个问题:
1、php建议使用8.0 查看面板中php 的扩展 fileinfo函数是否安装。
2、composer 源镜像 建议直接使用腾讯云镜像,因为阿里云镜像经常不更新。
3、安装完成后网站的运行目录修改到/public/目录
有的朋友可能说我看bilibili的视频他们修改成阿里云镜像就安装成功了。因地而异,相对稳定的都是使用腾讯云镜像,至少我在云服务器上安装宝塔设置composer镜像时都使用腾讯云镜像。
标签: ThinkPHP