使用 Apache 时在 PHP 中设置用于访问的环境变量

2022-01-15 00:00:00 environment-variables ubuntu php apache

我有一个 Linux 环境,我有一个 PHP Web 应用程序,它使用 PHP 中的 getenv 根据环境变量有条件地运行.我需要知道如何设置这些环境变量以使应用程序正常工作.我不确定如何在 Apache 上进行设置.

I have a Linux environment and I have a PHP Web Application that conditionally runs based on environment variables using getenv in PHP. I need to know how these environment variables need to be set for the application to work correctly. I am not sure how to set this up on Apache.

另外,我需要能够为每个域分别配置单独的环境变量.

Also, I need to be able to configure separate environment variables for each domain separately.

请就我如何实现这一点提出建议.

Please advice on how can I achieve this.

推荐答案

大意:

<VirtualHost hostname:80>
   ...
   SetEnv VARIABLE_NAME variable_value
   ...
</VirtualHost>

相关文章