Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

putenv has been disabled for security reasons when executing composer commands

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:

  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

like image 237
notExactlyAHero Avatar asked Aug 12 '18 21:08

notExactlyAHero


2 Answers

In the php.ini file, search and remove putenv if you found in inside the "disable_functions=" .

like image 69
Rashed Hasan Avatar answered Nov 03 '22 00:11

Rashed Hasan


All what you need to do is disable putenv inside php.ini file under disable_functions

If you don't know how to find php.ini do the following steps:

First, check your php version by typing in your terminal:

php -v

next search for php.ini file by typing:

find / -name php.ini

After finding the correct php.ini edit it with your preferred code editor.

Let's use nano

nano /path/to/php.ini

Look at disable_functions section or searching for putenv by hitting Ctrl + ^ and type putenv and Enter.

Remove putenv and hit Ctrl + x and save the file.

That's all! You are good to go and do your stuff.

like image 36
Oussama Avatar answered Nov 03 '22 00:11

Oussama