Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

110
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!