laravel 出于安全原因,在执行 composer 命令时已禁用 putenv
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/51812996/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
putenv has been disabled for security reasons when executing composer commands
提问by notExactlyAHero
I am studying Laravel. I installed php 7, mysql and nginx using WinNMP. I installed composer and , throught it, I installed laravel cli (Laravel\Installer). I am getting "putenv has been disabled for security reasons" all the time since I created the Laravel skeleton application. I got this message when accessing my Laravel application on the browser at the first launch, I got rid of this error by deleting this function wherever it appeared in \vendor\symfony\console\application.php. I know that it is a silly solution but I am just studying. But now I am learning Migration and I need to execute some commands I am getting this error again. The command in question is "composer dump-autoload", I got this message on the console:
我正在学习 Laravel。我使用 WinNMP 安装了 php 7、mysql 和 nginx。我安装了composer,并通过它安装了laravel cli(Laravel\Installer)。自从我创建 Laravel 框架应用程序以来,我一直收到“由于安全原因已禁用 putenv”。我在第一次启动时在浏览器上访问我的 Laravel 应用程序时收到此消息,我通过删除此函数出现在 \vendor\symfony\console\application.php 中的任何位置来消除此错误。我知道这是一个愚蠢的解决方案,但我只是在学习。但是现在我正在学习迁移并且我需要执行一些命令我再次收到此错误。有问题的命令是“composer dump-autoload”,我在控制台上收到了这条消息:
Warning: putenv() has been disabled for security reasons in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/bin/composer on line 52
[ErrorException]
putenv() has been disabled for security reasons
Obs. I've already deleted this function from disable_function on php.ini file
观察。我已经从 php.ini 文件的 disable_function 中删除了这个函数
回答by Rashed Hasan
In the php.ini file, search and remove putenv
if you found in inside the "disable_functions=" .
在 php.ini 文件中,putenv
如果您在“ disable_functions=”中找到,请搜索并删除。