开发环境:
PHP:7.4
宝塔:7.9.0
ThinkPHP:V6.1.4
初次安装tp6时出错:
D:\wwwroot>composer create-project topthink/think thinktp6
Warning: putenv() has been disabled for security reasons in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/composer/xdebug-handler/src/Process.php on line 97
Warning: putenv() has been disabled for security reasons in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Util/Platform.php on line 80
Creating a "topthink/think" project at "./thinktp6"
Cannot use topthink/think's latest version v8.0.0 as it requires php >=8.0.0 which is not satisfied by your platform.
Installing topthink/think (v6.1.0)
- Downloading topthink/think (v6.1.0)
- Installing topthink/think (v6.1.0): Extracting archive
Created project in D:\wwwroot\thinktp6
Composer could not detect the root package (topthink/think) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
In Platform.php line 80:
putenv() has been disabled for security reasons
解决方法:
1.如果使用宝塔
去宝塔的php配置的【禁用函数】标签页里删掉禁用的函数putenv
2.修改php.ini配置
为了避免修改错误,请在修改前备份原来的php.ini文件!
修改php的配置文件php.ini,
找到disable_functions这个地方,把putenv直接去掉或者备份一项disable_functions再去掉putenv即可。