Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

114
Visualizações
Apache can't read my environment variables

I created an environment variable called API_KEY on my linux server, when I run the following command on php, I get false, meaning there is no variable with that name.

$api = getenv("API_KEY");

I created the variable following this steps:

created a keys.sh file in /etc/profile.d/ and saved my variable with this format API_KEY="my variable value"

When I run the "printenv" command as user-ec2 or root I can see the environment variable is there, but what it seems to be the problem is that when apache tries to access it dosen´t show up, I don´t know what to do so that the apache user can find this variable.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I went to etc/httpd/conf, where my httpd.conf file was located and created the environment variables using:

SetEnv API_KEY API_KEY_VALEU

Now the apache user could return the environment variable when I used:

getenv('API_KEY');

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda