Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

113
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda