如何使用SETENV在Apache中读取变量? [英] How do you use SetEnv to read variables in Apache?

查看:162
本文介绍了如何使用SETENV在Apache中读取变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设置具有DOC_ROOT信息,但一个环境变量没有

I want to set an env variable that has the DOC_ROOT info but nothing

SetEnv PROJECT_BASE %{ENV:DOC_ROOT}
SetEnv LAYOUT_HOME  %{ENV:PROJECT_BASE}"/html/app/wordpress/"

然后就可以在PHP访问LAYOUT_HOME

and then be able to access LAYOUT_HOME in php

我怎样才能做到这一点?

How can I do this?

推荐答案

变量通过入店:

$ _ SERVER [LAYOUT_HOME]和$ _ SERVER [PROJECT_BASE]的全局变量。

$_SERVER["LAYOUT_HOME"] and $_SERVER["PROJECT_BASE"] global variable.

一个简单的测试,如果执行PHP中的下一个命令

A simple test if to execute the next command in php

< PHP的phpinfo(); ?>

和检查变量present和定义。

and check if the variable is present and is defined.

如果没有,那么可能会存在一定的制约PHP安装(例如,在一个共享的氛围 - sharedhosting)

If not, then may be exist some restricting in the php installation ( for example in a share ambiance - sharedhosting)

这篇关于如何使用SETENV在Apache中读取变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆