我在PHP中尝试了以下
$AWS_environment_variables = array(
"AWS_PATH" => NULL,
"AWS_AUTO_SCALING_HOME" => NULL,
"AWS_IAM_HOME" => NULL,
"AWS_ELB_HOME" => NULL,
"HOSTNAME" => NULL,
"EC2_AMITOOL_HOME" => NULL,
);
foreach($AWS_environment_variables as $key_name => &$value){
$value = getenv($key_name);
}
echo "<pre>";
print_r($AWS_environment_variables);
echo "</pre>";
在 ec2 中运行时,我得到以下信息。所有 AWS 特定的东西都是空的
Array
(
[AWS_PATH] =>
[AWS_AUTO_SCALING_HOME] =>
[AWS_IAM_HOME] =>
[AWS_ELB_HOME] =>
[HOSTNAME] =>
[EC2_AMITOOL_HOME] =>
)
标签#HowDoIDoIt?