Wordpress environmental variables with nginx

How do I use environmental variables for my wp-config.php? Where do I set these variables?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello @mlmarinas,

Can you please share what your end goal is? I’m not entierly sure what you mean by the above question but I’ll give it a try to answer as best to my knowledge as possible.

When you mention environmental variables with Nginx, all I can think is about environments that are added in PHP-FPM. You can set the environment variable in /etc/php/php-fpm.d/www.conf like this:

env[APP_ENV] = development

Then you’ll be able to get it with getenv(‘APP_ENV’) anywhere on your PHP application, as long as you are using that php-fpm instnace.

Is that what you were after?

Regards, KFSys