I'm trying to use SendGrid's API for which I need to access an environment variable that I've added to my root directory using the following command.
echo "export SENDGRID_API_KEY='YOUR_API_KEY'" > sendgrid.env
echo "sendgrid.env" >> .gitignore
source ./sendgrid.env
This has created a sendgrid.env
file in my root folder, added sendgrid.env
to my .gitignore
file, and added SENDGRID_API_KEY
as an environment variable.
However, PHP's getenv('SENDGRID_API_KEY')
key is not returning anything, and PHP's phpinfo()
does not reflect SENDGRID_API_KEY
as an environment variable.
Here are the API installation instructions.