Questions tagged [environment-variables]

Environment variables are configuration options that can be set in a shell or other similar environments. All programs started from within the shell can read them and configure themselves.

Filter by
Sorted by
Tagged with
2 votes
1 answer
9k views

How to create .env multiline variable

The title may be a bit confusing, so a little explanation. I need to configure an application by passing a PKCS1 PEM encoded key using environment variable. The App is configured using a .env file ...
2 votes
2 answers
10k views

Equivalent of PHP setlocale in an APACHE config file

I need to display a date in french locale. A solution is to use setlocale(LC_TIME, 'fr_FR'); But I'm looking to set the locale directly in the configuration of my apache server. In the /etc/httpd/conf/...
3 votes
1 answer
5k views

OpenVPN --route-up Missing environment variables when passing to script

I'm diving into the glory of OpenVPN and I'm having a bit of trouble manually configuring the routing tables. I'm on Arch Linux. I know OpenVPN automatically updates the routing tables when ...
11 votes
3 answers
24k views

Getting environment variables in PHP-FPM with Nginx

I've defined some environment variables like APP_ENV in my /etc/environment file, on my ArchLinux. If I type printenv, I see them. I've created this simple test file called… test.php <?php ...
1 vote
0 answers
63 views

Executing a list of commands on distinct lines with bash -c?

I pass a list of commands to a bash script through an environment variable as shown in the example below: CMDS=' date > date.txt cat date.txt date | rev ' script What is the correct ...
4 votes
1 answer
7k views

Scripts in /etc/profile.d are being executed twice on login

Background Info: I am trying to configure a Linux server running CentOS 7 for multiple users. After installing java I want to globally set the $JAVA_HOME environment variable for all users and add it ...
0 votes
0 answers
364 views

passing docker .env variables to nginx site configurations

from docker-compose.yml: nginx: volumes: - ./nginx/sites/:/etc/nginx/sites-available inside nginx/sites there are a bunch of .conf files for different sites. I'd like to pass variables ...
0 votes
0 answers
68 views

Ansible: no password in log for community.docker.docker_container env-vars

Via ansible (AWX) I start a docker container with the community.docker.docker_container module. I have some environment variables that I dont wat to be logged. Here is a small example: - name: &...
0 votes
0 answers
56 views

Where does .env (which contains the client secret) go?

I have a React app with a Node.js server. Here is the directory structure: .env app     .env     .gitignore     build/     node_modules/     package copy.json     package-lock.json     package.json    ...
0 votes
0 answers
68 views

Setting a HTTP Header in ProxyPass to have dynamic route

I am setting up a request header using : RequestHeader set X_FIELD "expr=%{tolower:%{req:SOME-VAL}}" and want to send the value of this HTTP Header in ProxyPass. now I want to send the same ...
1 vote
2 answers
1k views

How to pass environment variables with FreeBSD service command?

The rc.subr ${name}_env specifies this for setting environment variable: ${name}_env A list of environment variables to run command with. This will be passed as arguments to ...
30 votes
7 answers
186k views

How can I modify a user’s PATH environment variable without logging out?

The question pretty much says it all; I have users who do not have permission to edit their own PATH environment variable and if they need to have it modified for some reason, they need to log out so ...
0 votes
1 answer
386 views

host not found in "$server_listen_port" of the "listen" directive

With the following nginx config excerpt: map $server_name $server_listen_port { default 443; localhost. 80; localhost 80; } server { server_name "${ENVIRONMENT_SERVER_NAME}.&...
8 votes
3 answers
24k views

Apache Custom Header with an environment variable

I try to set a custom HTTP Header with an environment variable** with Apache server 2.4.6 and headers_module. I work inside a HTTP VHost on port 80. Everything work as expected with basic example ...
0 votes
0 answers
223 views

Docker compose scale with different environment variable value

I want to achieve scaling of the container based on the array of values (like a matrix set of values used for creating containers). I can't do scaling with a single container in docker compose file: ...
2 votes
1 answer
1k views

sourcing environment variable in bashrc: directly vs export from file yields different result - why

I am running systemd via user (i.e. enable-linger $USER) and I interact with services via systemctl --user I noticed a strange issue. Sourcing Type 1 In order for the above systemd to work for a user, ...
3 votes
3 answers
6k views

How to add new path to $PATH variable in a post-installation script of RPM?

I want to automatically add a new path to the $PATH variable each time when my RPM package is installed. I tried to use a post-installation script in the my RPM. Here is the part of RPM spec file ...
0 votes
1 answer
8k views

java.exe in "C:\Program Files (x86)\Common Files\Oracle\Java\javapath\java.exe" overridden local Java installation

Why and how come java.exe appeared in "C:\Program Files (x86)\Common Files\Oracle\Java\javapath\java.exe", on Windows 10, and even more surprisingly - overridden my OpenJDK's java.exe binary,...
0 votes
0 answers
102 views

I cannot get environment variable from apache

On a Centos 8, I added a SetEnv into my VirtualHost conf: <VirtualHost *:XXXX> Alias /static/ /opt/industrialisation/xxxx/xxxx/xxxx/ <Directory /opt/industrialisation/xxx/xxxx/> ...
2 votes
1 answer
2k views

How does Windows set the %SystemRoot% variable?

The %SystemRoot% environment variable contains the path to the Windows directory. (e.g. c:\windows) SystemRoot is not configured in Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session ...
0 votes
1 answer
394 views

PHP exec(iptables --help) works but exec(iptables --command) doesn't work

In PHP 7.3.33 and Apache 2.4 I want to run iptables from PHP (web server enviroment) in order to block/unblock IPs, from command line, this works fine: /usr/sbin/iptables --insert INPUT --source ...
2 votes
1 answer
1k views

/etc/environment.d does not take effect on Archlinux

I believe systemd-environment-d-generator parses conf files under /etc/environment.d/. cat /etc/environment.d/60-foo.conf FOO=xxx But even after reboot, the environment variable 'FOO' does not ...
62 votes
4 answers
105k views

Can the environment variables tool in Windows be launched directly?

Is there a more direct way to the environmental variables GUI than the following? Right click 'My Computer' and select 'Properties'. Click 'Advanced System Settings' link. Click 'Advanced' tab. Click ...
0 votes
1 answer
7k views

How to make changes to environmental variables on Windows Server 2016 stick and stay permanent?

After setting the CLASSPATH environmental variable on Windows Server 2016 using the Control Panel/System/Advanced Settings/Environmental Variables UI Tool - the CLASSPATH value reverts back to its ...
1 vote
1 answer
2k views

Why environment variable set by SetEnv in apache httpd.conf cannot be passed to php?

I set an environment variable in httpd.conf: SetEnv http_proxy "http://localhost:3128" But I cannot get this variable in php using getenv: <?php echo getenv("http_proxy"); ...
1 vote
3 answers
3k views

how to set PATH in CentOS so that it is visible in PHP

I need my PATH environment variable to include /usr/local/bin when seen from PHP, so that I can execute binaries that are in /usr/local/bin with exec() in PHP code without writing their full path, e.g....
0 votes
1 answer
231 views

Getting command not found using sudo, but not for running command as root without sudo

wierd issue where if you use sudo command for certain commands it is not found. But runnning it as root user WITHOUT sudo does work root@ip-172-31-43-153:/home/ubuntu# sudo xfs_growfs -d / sudo: ...
1 vote
1 answer
2k views

Setting enviromental variables for login shells under root account in FreeBSD

I am currently in the process of configuring Open Grid Scheduler in FreeBSD. As part of this process I need to set the environmental variableSGE_ROOTas root. To do this I have been experimenting with ...
-1 votes
1 answer
3k views

How to increase the Java Memory in Windows Server 2012 R2?

I am trying to follow This Link to increase the memory that is available to the Java Runtime Environment, because I encountered the "insufficient memory for the Java Runtime Environment to ...
9 votes
4 answers
26k views

"service"-command and environment variables

I am trying to start a service that requires a env. variable to be set to certain path. I set this variable in "/etc/profile.d/". However when I start this service using the service command, it doesn'...
1 vote
1 answer
970 views

Condition depending on domain in .htaccess: SetEnvIf and IfDefine?

I would like to add a rule in .htaccess that "Does something" (actually enable a httpauth user restriction) depending on the domain name. I thought I had it and did: <IfModule ...
1 vote
1 answer
270 views

How to set a proxy for terminal without exporting the environment variable?

How to set a proxy for terminal without exporting the environment variable? I am using a Ubuntu machine and I would like to do that? If it not possible, are there any apps to help me do that? Thank ...
1 vote
1 answer
3k views

How to Easily Pass an Environment Variable to an .exe in "Bash on Windows 10"?

I am looking for a way to easily pass an environment variable to a .exe when invoked from the Bash on Windows 10 terminal. It seems that TEST=somevalue example.exe does not work.
1 vote
1 answer
2k views

Apache environment variables for CGI not setting

I am trying to set my environment variables for the Apache webserver as it is not the correct Perl package. I followed the recommendation of one of the answers on Server Fault for updating the httpd ...
2 votes
3 answers
2k views

Dynamic logic in environment variable?

I regularly invoke a particular remote server from a (Linux/bash) command line via tools like cURL or wget. This server requires an authentication token that expires every 10 minutes. I have a program ...
0 votes
2 answers
3k views

!Linux standard path information, similar to windows path variables, like %AppData%, %UserProfile%, etc.?

Is there, in linux variables, or some other means to find per/system paths, similar to windows path variables, like %AppData%, %UserProfile%, %AllUsersProfile%, %ProgramFiles%, %SystemRoot%, %...
43 votes
2 answers
89k views

CentOS /usr/local/lib system wide $LD_LIBRARY_PATH?

I install custom software in /usr/local/lib. How do I set the PATH and LD_LIBRARY_PATH in CentOS 6 system-wide to use /usr/local/lib. I realize there may be more than one way. What's the simplest and ...
10 votes
1 answer
4k views

SSH: Behavior of SetEnv for TERM variable

I want to set the TERM environment variable to a different value for each of my remote machines, so i used SetEnv TERM=myTermForRemoteVar in ~/.ssh/config. The remote machine still sees TERM=...
2 votes
3 answers
3k views

Using ENV variables in Postfix and Dovecot configuration files

I'm trying to dockerize my mailing server and I'm having some troubles regarding how am I supposed to use environment variables inside Postfix and Dovecot configuration files (I'm using the latest ...
1 vote
1 answer
4k views

Environment variables in systemd ExecStart, ExecStop clauses not working as expected

I'm working on some unit files for some systemd services. The path prefix to some of my binaries is quite long and they are used several times in ExecStart=, ExecStartPost=, and ExecStop= clauses. I ...
7 votes
2 answers
6k views

How do I prevent Apache/PHP from showing the environment variables section in phpinfo()?

I need to prevent users from accidentally exposing private data stored in the environment variables with phpinfo(). Is there a way to configure apache or php.ini to disallow sections rendered with ...
0 votes
1 answer
437 views

Erased System Path Variables

I was writing a batch file that was supposed to automatically set up a computer to receive "psexec" remote commads. Unluckly i didn't really pay attention to what i was writing and i wrote ...
19 votes
8 answers
140k views

How to change default /tmp to /home/user/tmp

Is there an environment variable to set the temporary directory on debian based systems? I have a java applet that uses that environement variable and it's getting confused when launching two ...
12 votes
3 answers
16k views

Can start-stop-daemon use environmental variables?

I need to daemonize a Windows app running in Wine, and create a pid in /var/run. Since it requires an X11 session to run, I need to make sure the $DISPLAY variable is set in the running user's ...
35 votes
6 answers
46k views

Setting a variable for a given SSH host

In ssh_config, one can choose to export some environment variables to the host using SendEnv. Is there also a way to force a given value for this variable, per host? For example, would it be possible ...
5 votes
1 answer
5k views

Use basic auth conditionally in nginx

I have an NGINX server built into Docker image which I want to use in both production and staging environments. The problem is that staging environment requires a Basic Auth to be enabled in order to ...
9 votes
3 answers
2k views

Excluding Environment Variables from ZSH Autocomplete

Quick example: ~ $ wor<TAB> ~ $ WORDCHARS= ...
2 votes
2 answers
32k views

How to edit users PATH environment variable remotely in Windows?

Wondering what tools are available to remotely edit (find and replace actually) the PATH environment variable on all users workstations across the enterprise? We do use SCCM (formerly SMS), but I don'...
230 votes
7 answers
487k views

How do you add a Windows environment variable without rebooting?

I would like to add an Environment variable to a Windows machine (desktop or server) and be able to use it without rebooting that machine. Say you have a production server which hosts a variety of ...
1 vote
1 answer
343 views

Avoid pod environment variables' conflicts with Docker-style links

We running or components in Kubernetes with Docker as container runtime. A problem with it is that pod environment is polluted with Docker-style link variables like SERVICENAME_PORT_8181_TCP ...

1
2 3 4 5
9