Menu

#504 Can no longer symlink to shared code

Major
open
nobody
None
1
2021-06-07
2021-06-02
Anonymous
No

Up through MRBS 1.7.5 I was able to use symbolic links in /home/$user/web/mrbs to the files in /usr/local/share/mrbs/web but when upgrading to 1.9.2 that was no longer possible; I started getting 500 errors from the files in the css directory even though in the Apache configuration I had

AllowOverride all
Options +FollowSymLinks

This occurred in two test environments: {CentOS 6, Apache 2.,2, PHP-FPM 7.3} and { CentOS 8, Apache 2.4, PHP-FPM 7.4}. I finally just copied the code into the user directory and was able to see the CSS (and stop getting unsupported browser warnings). I'm not sure why this is the case, but it looks like we may need to change our entire workflow unless you have some advice.

Discussion

  • Campbell Morrison

    What were the errors that you were getting (have a look in your PHP error log)?

     
  • Anonymous

    Anonymous - 2021-06-02
    from /var/lolg/php-fpm:
    [02-Jun-2021 16:32:40 UTC] PHP Fatal error:  require_once(): Failed opening required 'config.inc.php' (include_path='.:/usr/share/pear:/usr/share/php') in /usr/local/share/applications/mrbs-1.9.2/web/defaultincludes.inc on line 24
    [02-Jun-2021 16:32:40 UTC] PHP Warning:  require_once(config.inc.php): failed to open stream: No such file or directory in /usr/local/share/applications/mrbs-1.9.2/web/defaultincludes.inc on line 24
    

    If I try touching an empty /usr/local/share/applications/mrbs-1.9.2/web/config.inc.php file, I get

    [02-Jun-2021 14:27:21 America/New_York] Uncaught exception 'Error' in /usr/local/share/applications/mrbs-1.9.2/web/edit_users.php at line 563
    Call to undefined method MRBS\Auth\AuthNone::getUsers()
    #0 {main}
    
    MRBS GET: Array
    (
    )
    MRBS POST: Array
    (
    )
    MRBS SESSION: Array
    (
        [csrf_token] => 25f0b5f259821c90b0acd0ca30a0c0382c954a035df1c35fb86d75550885d31d
    )
    

    Note that I'm authenticating users with Shibboleth and have the following in config.inc.php in the user directory:

    $auth['session']  = "remote_user"; 
    //$auth['type'] = 'config'; // Got permissions in 1.7.n
    $auth['type'] = 'none';     // Recommended in 1.9.n
    

    I haven't started adding user permissions yet on the new server, but I'm hoping that the same

    $auth["admin"][] = caladmin
    $auth["user"][] = user1
    $auth["user"][] = user2
    

    pattern we had before will still work with type=none.

    I'm moving ten calendars to this new server, and don't want to duplicate code; the symlink method was working for us with the application path "/user/secure/mrbs" -- if I try the multisite method, which needs docs, it looks like the path will have to change to "/mrbs/sites/user"?

     
  • Campbell Morrison

    I'll need to investigate why the symlinks aren't working.

    However multisite mode would probably solve your problem. It was specifically designed to avoid duplicating code. You have a single instance of MRBS, but each site is referenced by an additional parameter in the query string, eg index.php?site=5, or index.php?site=mars. Then in the sites directory you have subdirectories, eg 5 and mars, and each subdirectory contains its own config file which overrides the global config file (which overrides systemdefaults.inc.php). At the very minimum the config file probably has a table prefix specific to the site.

     
  • Anonymous

    Anonymous - 2021-06-02

    We need to do remote_user based access control on each calendar in Apache, as well as the user/admin permissions in MRBS, and would like to keep the URL paths as they were on the old server, rather than having the calendar selection be in a field.

     
  • Campbell Morrison

    Are you just seeing the problem on the new server or do you also see it on the old server?

     
  • Anonymous

    Anonymous - 2021-06-04

    I saw it on the old server but attributed it to it being an old system, so when I saw it again on the new, I realized it was a new issue in the code, not just an Apache/PHP config problem.

     
  • Anonymous

    Anonymous - 2021-06-04

    I tried setting MRBS_ROOT via .htaccess and config.inc.php , but the declaration in defaultincludes.inc overwrites it; dumping all vars with

    <?php
    namespace MRBS;
    require_once 'defaultincludes.inc';
    require_once 'config.inc.php';
        phpinfo();
    //$arr = get_defined_vars();
    //print_r($arr);
    $con = get_defined_constants();
    print("<pre>".print_r($con)."</pre>");
    

    produces [MRBS_ROOT] => /usr/local/share/applications/mrbs-1.9.2/web

     
  • John Beranek

    John Beranek - 2021-06-07

    Perhaps change that section of defaultincludes.inc to:

    if (!empty($_ENV['MRBS_ROOT']))
    {
      define('MRBS_ROOT', $_ENV['MRBS_ROOT']);
    }
    else
    {
      define('MRBS_ROOT',     __DIR__);                   // Root of MRBS installation
    }
    
     

    Last edit: John Beranek 2021-06-07