相关推荐recommended
解决PHP Warning: putenv() has been disabled for security reasons in phar:
作者:mmseoamin日期:2023-12-21

在使用composer的时候报一下错误,这是因为php禁用了putenv() 函数

PHP Warning: putenv() has been disabled for security reasons in phar:///usr/bin/composer/vendor/composer/xdebug-handler/src/Process.php on line 97

Warning: putenv() has been disabled for security reasons in phar:///usr/bin/composer/vendor/composer/xdebug-handler/src/Process.php on line 97
PHP Warning: putenv() has been disabled for security reasons in phar:///usr/bin/composer/src/Composer/Util/Platform.php on line 78

Warning: putenv() has been disabled for security reasons in phar:///usr/bin/composer/src/Composer/Util/Platform.php on line 78

如果使用宝塔

就去宝塔的php配置里删掉禁用的函数putenv

修改php.ini配置

为了避免修改错误!请在修改前备份原来的putenv文件!
修改php的配置文件,php.ini
找到disable_function这个地方,把putenv去掉即可。