B.V. Raghav
2015-06-06 21:02:23 UTC
Hi..
appRoot is read from the SetEnv WT_APP_ROOT as defined in .htaccess
But the same is not propogated to the WApplication when run under mod_fcgid
This is the test code:
--- code starts
std::string config_file = "Config File: ";
config_file += env.getCgiValue("WT_CONFIG_XML");
std::string app_root_path = "App Root: ";
app_root_path += env.getCgiValue("WT_APP_ROOT");
root()->addWidget(new Wt::WText("<strong>Cgi Values</strong>"));
root()->addWidget(new Wt::WBreak());
root()->addWidget(new Wt::WText(config_file));
root()->addWidget(new Wt::WBreak());
root()->addWidget(new Wt::WText(app_root_path));
for (int i = 0; i < 4; ++i)
root()->addWidget(new Wt::WBreak());
root()->addWidget(new Wt::WText("<strong>Wt Env Values</strong>"));
root()->addWidget(new Wt::WBreak());
root()->addWidget(new Wt::WText("appRoot: " + WApplication::appRoot()));
root()->addWidget(new Wt::WBreak());
root()->addWidget(new Wt::WText("docRoot: " + WApplication::docRoot()));
root()->addWidget(new Wt::WBreak());
root()->addWidget(new Wt::WText("env::appRoot: " + environment().getCgiValue("WT_APP_ROOT")));
for (int i = 0; i < 4; ++i)
root()->addWidget(new Wt::WBreak());
root()->addWidget(new Wt::WText("<strong>Server Values</strong>"));
root()->addWidget(new Wt::WBreak());
root()->addWidget(new Wt::WText("appRoot: " + Wt::WServer::instance()->appRoot()));
for (int i = 0; i < 4; ++i)
root()->addWidget(new Wt::WBreak());
root()->addWidget(new Wt::WText("<strong>Nascent Env</strong>"));
root()->addWidget(new Wt::WBreak());
root()->addWidget(new Wt::WText(::getenv("WT_APP_ROOT")));
// root()->addWidget(new Wt::WText(std::string("appRoot: ") + ::getenv("WT_APP_ROOT")));
root()->addWidget(new Wt::WBreak());
root()->addWidget(new Wt::WText(::getenv("WT_CONFIG_XML")));
// root()->addWidget(new Wt::WText(std::string("configFile: ") + ::getenv("WT_CONFIG_XML")));
--- code ends
Here is the output:
--- output starts
Cgi Values
Config File:
App Root: /home/bvr/wt/approot
Wt Env Values
appRoot:
docRoot: /var/www/html
env::appRoot: /home/bvr/wt/approot
Server Values
appRoot:
Nascent Env
--- output ends
::getenv outputs nothing
getCgiValue holds the value,
but WApplication->appRoot() is empty
The config is Wt 3.3.4 + Boost v1.58 + GCC-4.9.2 + Apache 2.4 + mod_fcgid v2.3.9
Where lies the problem?
r
--
(B.V. Raghav)
P: +91-9450988137
------------------------------------------------------------------------------
appRoot is read from the SetEnv WT_APP_ROOT as defined in .htaccess
But the same is not propogated to the WApplication when run under mod_fcgid
This is the test code:
--- code starts
std::string config_file = "Config File: ";
config_file += env.getCgiValue("WT_CONFIG_XML");
std::string app_root_path = "App Root: ";
app_root_path += env.getCgiValue("WT_APP_ROOT");
root()->addWidget(new Wt::WText("<strong>Cgi Values</strong>"));
root()->addWidget(new Wt::WBreak());
root()->addWidget(new Wt::WText(config_file));
root()->addWidget(new Wt::WBreak());
root()->addWidget(new Wt::WText(app_root_path));
for (int i = 0; i < 4; ++i)
root()->addWidget(new Wt::WBreak());
root()->addWidget(new Wt::WText("<strong>Wt Env Values</strong>"));
root()->addWidget(new Wt::WBreak());
root()->addWidget(new Wt::WText("appRoot: " + WApplication::appRoot()));
root()->addWidget(new Wt::WBreak());
root()->addWidget(new Wt::WText("docRoot: " + WApplication::docRoot()));
root()->addWidget(new Wt::WBreak());
root()->addWidget(new Wt::WText("env::appRoot: " + environment().getCgiValue("WT_APP_ROOT")));
for (int i = 0; i < 4; ++i)
root()->addWidget(new Wt::WBreak());
root()->addWidget(new Wt::WText("<strong>Server Values</strong>"));
root()->addWidget(new Wt::WBreak());
root()->addWidget(new Wt::WText("appRoot: " + Wt::WServer::instance()->appRoot()));
for (int i = 0; i < 4; ++i)
root()->addWidget(new Wt::WBreak());
root()->addWidget(new Wt::WText("<strong>Nascent Env</strong>"));
root()->addWidget(new Wt::WBreak());
root()->addWidget(new Wt::WText(::getenv("WT_APP_ROOT")));
// root()->addWidget(new Wt::WText(std::string("appRoot: ") + ::getenv("WT_APP_ROOT")));
root()->addWidget(new Wt::WBreak());
root()->addWidget(new Wt::WText(::getenv("WT_CONFIG_XML")));
// root()->addWidget(new Wt::WText(std::string("configFile: ") + ::getenv("WT_CONFIG_XML")));
--- code ends
Here is the output:
--- output starts
Cgi Values
Config File:
App Root: /home/bvr/wt/approot
Wt Env Values
appRoot:
docRoot: /var/www/html
env::appRoot: /home/bvr/wt/approot
Server Values
appRoot:
Nascent Env
--- output ends
::getenv outputs nothing
getCgiValue holds the value,
but WApplication->appRoot() is empty
The config is Wt 3.3.4 + Boost v1.58 + GCC-4.9.2 + Apache 2.4 + mod_fcgid v2.3.9
Where lies the problem?
r
--
(B.V. Raghav)
P: +91-9450988137
------------------------------------------------------------------------------