View Issue Details

IDProjectCategoryView StatusLast Update
04896User patchesInstallationpublic2012-06-21 14:16
Reporterstarmonkey Assigned To 
Status confirmedResolutionopen 
Product Version1.90 
Summary04896: Dynamic $rooturl to eliminate an install/config step

Hi guys, I just thought I'd share a hack with you guys, mainly to make sure I'm not doing something bad.

I prefer my php webapps to work out as much of their environment as possible, to save on configuration steps.

As such, I edited config.php with the following:

// The root web url for your limesurvey installation (without a trailing slash).
//$rooturl = "http://{$_SERVER['HTTP_HOST']}/path/to/limesurvey";
// SM 20Jan11: Dynamic rooturl, for /admin pages, set one level up
$rooturl = "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']);
if('admin' == basename($rooturl)) { $rooturl = dirname($rooturl); }

Anyway, feedback welcome. I did this because my dev/staging and live environments have different paths/urls, and I got tired of maintaining different settings per environment!

Steps To Reproduce

1) Edit config.php and update the line that sets $rooturl
2) Enjoy a slice of chocolate cake as you deploy to live without fear

Additional Information

Originally I posted this as a forum thread here:

TagsNo tags attached.
Complete LimeSurvey version number (& build)9672




2011-01-23 19:43

partner   ~13959

Thibault, what do you think about this?

Before implementing this we might also want to ping Carsten if this has any effects on Limeservice.



2011-03-08 13:31

developer   ~14328

Carsten I prefer to let you decide on this one.



2011-03-08 15:33

administrator   ~14339

I looked up on PHP_SELF and I think there is no risk involved because it is tamed by the dirname() call.
HOwever the 'if 'admin' ' part is hardcoded and ignores the fact that the LimeSurvey /admin directory can be renamed.



2011-03-28 02:27

administrator   ~14580

Starmonkey, do you see a way to resolve the '/admin' issue I talked about?

Issue History

Date Modified Username Field Change
2011-01-22 23:49 starmonkey New Issue
2011-01-23 19:42 Mazi Assigned To => lemeur
2011-01-23 19:42 Mazi Status new => assigned
2011-01-23 19:43 Mazi Note Added: 13959
2011-03-08 13:30 lemeur Assigned To lemeur => c_schmitz
2011-03-08 13:31 lemeur Note Added: 14328
2011-03-08 15:33 c_schmitz Note Added: 14339
2011-03-28 02:27 c_schmitz Note Added: 14580
2012-06-21 13:32 c_schmitz Status assigned => confirmed
2012-06-21 14:16 c_schmitz Assigned To c_schmitz =>