2

I am using Windows 7 Ultimate, PHP 5.2, VMWare (with Ubuntu Server V11.04)

My plan is to create an environment variable in both the linux and windows platforms, and to make them work in PHP. So I created the variable "ROOT_DIR" in Windows and another "ROOT_DIR" variable in Windows.

I have this code in PHP that I expect to work in both the platforms:

<?php
echo 'My username is ' .$_ENV["ROOT_DIR"] . '!';
?>

But in Linux, all it outputs is NULL. I wonder what I'm doing wrong here. Any help would be appreciated.

4

1 回答 1

0

如果您通过浏览器运行脚本,请尝试将以下内容添加到您的主.htaccess文件中

SetEnv ROOT_DIR "/path/to/root/"

阿帕奇设置环境

于 2012-12-19T07:11:00.103 回答