We are moving to Git Issues for bug tracking in future releases. During transition, content will be in both tools. If you'd like to file a new bug, please create an issue.

Bug 7073 - Review/facilitate mbria's hosting configuration
Review/facilitate mbria's hosting configuration
Status: NEW
Product: OJS
Classification: Unclassified
Component: General
All All
: P3 normal
Assigned To: PKP Support
Depends on: 8344
  Show dependency treegraph
Reported: 2012-01-26 04:14 PST by Alec Smecher
Modified: 2014-08-19 08:44 PDT (History)
2 users (show)

See Also:
Version Reported In:
Also Affects:


Note You need to log in before you can comment on or make changes to this bug.
Description Alec Smecher 2012-01-26 04:14:43 PST
See http://pkp.sfu.ca/support/forum/viewtopic.php?f=8&t=7578&start=15 for details.
Comment 1 Marc Bria 2013-07-24 07:39:14 PDT
For OJS 2.3.6, two minor changes are required for RESTFUL urls. 
More info about those changes here:
* http://pkp.sfu.ca/support/forum/viewtopic.php?f=8&t=7578&start=15#p32090
* http://pkp.sfu.ca/support/forum/viewtopic.php?f=8&t=7578&start=15#p32525


At lib/pkp/classes/session/SessionManager.inc.php:
// ini_set('session.cookie_path', $request->getBasePath() . '/');
   ini_set('session.cookie_path', Config::getVar('general', 'session_cookie_path')); //MBR: To allow RESTful with multiple O

And in config.inc.php, add a new variable:
; Variable to allow multiple OJS sites with RESTful URLs in a multisite configuration:
    session_cookie_path = /
Comment 2 Alec Smecher 2013-07-24 12:09:42 PDT
Marc, the trouble with this change...

//define('INDEX_FILE_LOCATION', dirname(dirname(__FILE__)) . '/index.php');
define('INDEX_FILE_LOCATION', realpath(dirname(dirname($_SERVER["SCRIPT_FILENAME"]))). '/index.php');

...is that PHP can be invoked from at least four places:
- Through the web server via the index.php script
- Via the tools/ scripts
- Via the lib/pkp/tools/ scripts
- Via lib/pkp/lib/tinymce/jscripts/tiny_mce/plugins/jbimages/integratePKP.php (this one is an outlier)

The proposed approach calculates a relative directory based on the invoking script, which could be one of several directories depending on which of the above cases were dealing with.

The original approach works out a relative directory based on the location of the bootstrap.inc.php script itself, which is less likely to change (though your symlinked situation is running into trouble here).

Unfortunately we can't use a configuration variable here because we need to load the config file classes, and that depends on INDEX_FILE_LOCATION being correct.
Comment 3 Marc Bria 2013-07-25 02:33:47 PDT
So, ok with this patch:

But need to test deeper this one:

... to detail what are the collateral effects in a symlinked environment.

Isn't it?
Comment 4 Alec Smecher 2013-07-25 10:46:02 PDT
Add config template for session_cookie_path (optional)
Comment 5 Alec Smecher 2013-07-25 10:47:02 PDT
Add support for config-specified session_cookie_path (optional)
Comment 6 Alec Smecher 2013-07-25 10:47:02 PDT
Add config template for session_cookie_path (optional)
Comment 7 Alec Smecher 2013-07-25 10:48:02 PDT
Add config template for session_cookie_path (optional)
Comment 8 Alec Smecher 2013-07-25 10:48:52 PDT
Marc, that's correct. I've just committed the changes to add support for the session_cookie_path config parameter to the master branches for OJS, OCS, OHS, and OMP -- the only difference from what you've suggested is that I added a default fallback to the old behavior when the variable isn't specified. By default it isn't specified in the config template. That ought to prevent this from surprising anyone on upgrade.
Comment 9 Alec Smecher 2013-07-25 10:49:02 PDT
Add config template for session_cookie_path (optional)
Comment 10 Marc Bria 2013-07-29 00:35:32 PDT
Thanks Alec.

To avoid mixing stuff, I open new issues with the problems that still need to be fixed to close this global task.

Symlinked hosted configuration: Unable to reach /tools scripts

Symlinked hosted configuration: Some PKP classes redirect to base folder.
(need more info to report properly)