Error "Warning: putenv () has been disabled for security reasons"

1

When I upload to production I get these errors:

  

Warning: putenv () has been disabled for security reasons in /home/httpd/htdocs/telekobr/site/vendor/vlucas/phpdotenv/src/Dotenv.php on line 86 reasons in /home/httpd/htdocs/telekobr/site/vendor/vlucas/phpdotenv/src/Dotenv.php on line 86 Warning: putenv () has been disabled for security reasons in / home / httpd / htdocs / telekobr / site / vendor / vlucas / phpdotenv / src / Dotenv.php on line 86 Warning: putenv () has been disabled for security reasons in /home/httpd/htdocs/telekobr/site/vendor/vlucas/phpdotenv/src/Dotenv.php on line Warning: putenv () has been disabled for security reasons in /home/httpd/htdocs/telekobr/site/vendor/vlucas/phpdotenv/src/Dotenv.php on line 86 Warning: /home/httpd/htdocs/telekobr/site/vendor/vlucas/phpdotenv/src/Dotenv.php on line 86 Warning: putenv () has been disabled for security reasons in / home / httpd / htdocs / telekobr / site / vendor / vlucas / phpdotenv / src / Dotenv.php on line Warning: putenv () has been disabled for security reasons in /home/httpd/htdocs/telekobr/site/vendor/vlucas/phpdotenv/src/Dotenv.php on line 86 Warning: /home/httpd/htdocs/telekobr/site/vendor/vlucas/phpdotenv/src/Dotenv.php on line 86 Warning: putenv () has been disabled for security reasons in / home / httpd / htdocs / telekobr / site / vendor / vlucas / phpdotenv / src / Dotenv.php on line 86 Warning: putenv () has been disabled for security reasons in /home/httpd/htdocs/telekobr/site/vendor/vlucas/phpdotenv/src/Dotenv.php on line 86 Warning : putenv () has been disabled for security reasons in /home/httpd/htdocs/telekobr/site/vendor/vlucas/phpdotenv/src/Dotenv.php on line 86 Warning: putenv () has been disabled for security reasons in / home /httpd/htdocs/telekobr/site/vendor/vlucas/phpdotenv/src/Dotenv.php on line 86 Warning: putenv () has been disabled for security reasons in / home / httpd / htdocs / telekobr / site / vendor / vlucas / phpdotenv / src / Dotenv.php on lin e 86 Warning: putenv () has been disabled for security reasons in /home/httpd/htdocs/telekobr/site/vendor/vlucas/phpdotenv/src/Dotenv.php on line 86 in /home/httpd/httpd/htdocs/telekobr/site/vendor/vlucas/phpdotenv/src/Dotenv.php on line 86 Warning: putenv () has been disabled for security reasons in / home / httpd / htdocs / telekobr / site / vendor /vlucas/phpdotenv/src/Dotenv.php on line 86

I'm using Laravel 5.1 and the server is running PHP5.6

    
asked by anonymous 11.05.2017 / 18:08

1 answer

4

getenv is not a function of Laravel , despite of being used by it, similar messages to this:

  

Warning: ... has been disabled for security reasons

They indicate that the server administrator disabled in php.ini some function or class specifies, in his case php.ini should be something like:

; This directive allows you to disable certain functions for security reasons.
; It receives a comma-delimited list of function names. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
; http://php.net/disable-functions
disable_functions=getenv

The only way to enable is to edit and remove getenv from disable_functions , if you do not have access to php.ini only by contacting hosting or server administrator.

If you have access just leave it empty like this:

; This directive allows you to disable certain functions for security reasons.
; It receives a comma-delimited list of function names. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
; http://php.net/disable-functions
disable_functions=

Generally in Linux the php.ini for Apache is located in (being php5. *):

/etc/php5/apache2/php.ini

However, if you are in doubt about the location, create a file info.php in the htdocs folder and open it via browser http://meusite/info.php search for php.ini with Ctrl + F it will show the location, delete info.php for security reasons, it exposes sensitive data from the server.

Then with the location of php.ini correct open the editor / word processor using sudo / su , after editing and saving restart Apache , the command is this sudo / su ):

service apache2 restart

If you are using Xampp the locations change and this explained I do not apply, Xampp usually has a configuration panel that facilitates all this (I can not say why I do not use).

  

Note:

     

To disable a function, for example the mail function, we use    disable_functions like this:

     
disable_functions=mail
     

And to disable a class, for example Directory , we use disable_classes like this:

     
disable_classes=Directory
    
11.05.2017 / 18:16