blogger

JackS·Zhao

人生就像开车在路上走,你我只是其中的一个驾驶员。送走老的、迎来小的,匆匆看过路边风景。一直向前行驶,却不知道是谁修的这条路。
宝塔安装thinkphp8.1.4遇到的问题

时间:2026-10-7    作者:JackS·Zhao    分类: ThinkPHP


第一:php版本必须是大于8.2的,我用的是8.2.28
运行thinkphp安装命令 composer create-project topthink/think tp8 提示下面错误

composer create-project topthink/think tp8
Creating a "topthink/think" project at "./tp8"
Installing topthink/think (v8.1.3)
  - Installing topthink/think (v8.1.3): Extracting archive
Created project in /www/wwwroot/tp8
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires topthink/think-filesystem ^2.0|^3.0 -> satisfiable by topthink/think-filesystem[v2.0.0, v2.0.1, v2.0.2, v2.0.3, v3.0.0].
    - league/flysystem[3.35.3, ..., 3.36.0] require league/flysystem-local ^3.0.0 -> satisfiable by league/flysystem-local[3.15.0, ..., 3.35.3].
    - league/flysystem-local[3.15.0, ..., 3.35.3] require ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension.   <-重点来了看这一行 Install or enable PHP's fileinfo extension
    - topthink/think-filesystem[v2.0.0, ..., v2.0.1] require topthink/framework ^6.1 -> found topthink/framework[v6.1.0, ..., v6.1.5] but it conflicts with your root composer.json require (^8.0).
    - topthink/think-filesystem v2.0.2 requires league/flysystem ^2.0 -> found league/flysystem[2.0.0, ..., 2.5.0] but these were not loaded, because they are affected by security advisories ("PKSA-w9tt-7782-78jx", "PKSA-pwh8-d4fr-nywn"). Go to https://packagist.org/security-advisories/ to find advisory details. To ignore the advisories, add their IDs to the "policy.advisories.ignore-id" config or add the package to "policy.advisories.ignore". To turn the feature off entirely, you can set "policy.advisories.block" to false.
    - topthink/think-filesystem v2.0.3 requires league/flysystem ^1.1.4 -> found league/flysystem[1.1.4, ..., 1.1.10] but these were not loaded, because they are affected by security advisories ("PKSA-w9tt-7782-78jx"). Go to https://packagist.org/security-advisories/ to find advisory details. To ignore the advisories, add their IDs to the "policy.advisories.ignore-id" config or add the package to "policy.advisories.ignore". To turn the feature off entirely, you can set "policy.advisories.block" to false.
    - topthink/think-filesystem v3.0.0 requires league/flysystem ^3.0 -> satisfiable by league/flysystem[3.35.3, 3.36.0].

To enable extensions, verify that they are enabled in your .ini files:
    - /www/server/php/82/etc/php-cli.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-fileinfo` to temporarily ignore these required extensions. 

上面要求我们安装fileinfo扩展,安装完成后重新加载配置,接着启用安装,第二个问题来了

composer create-project topthink/think tp8
PHP Fatal error:  Uncaught Error: Call to undefined function Composer\XdebugHandler\putenv() in phar:///usr/bin/composer/vendor/composer/xdebug-handler/src/Process.php:98
Stack trace:
#0 phar:///usr/bin/composer/vendor/composer/xdebug-handler/src/Status.php(59): Composer\XdebugHandler\Process::setEnv()
#1 phar:///usr/bin/composer/vendor/composer/xdebug-handler/src/XdebugHandler.php(101): Composer\XdebugHandler\Status->__construct()
#2 phar:///usr/bin/composer/bin/composer(42): Composer\XdebugHandler\XdebugHandler->__construct()
#3 /usr/bin/composer(29): require('...')
#4 {main}
  thrown in phar:///usr/bin/composer/vendor/composer/xdebug-handler/src/Process.php on line 98

这个错误,需要我找到/www/server/php/82/etc/php-cli.ini文件从里面删除被禁用函数 putenv;

,这次再次thinkphp8的安装,又提示我错我:

In Process.php line 147:

  The Process class relies on proc_open, which is not available on your PHP i  
  nstallation

这个也很明显又让我去找该死的/www/server/php/82/etc/php-cli.ini文件,从里面删除被警用的函数proc_open,后来我看了相关文献还要删除proc_get_status、popen、exec、shell_exec这几个被禁用的函数。

进入文件找到disable_functions,我在找的过程中只找到了proc_open,popen,exec,shell_exec 然后重载配置

进入中断重新执行thinkphp8.1.3的安装 ,OK完美通过