We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32911
    • 13 Posts
    Hi Zap,

    Included;

    #Options +FollowSymlinks
    RewriteEngine On
    RewriteBase /

    #added by shaun white to overcome file manager issue
    DirectoryIndex index.php


    # Fix Apache internal dummy connections from breaking [(site_url)] cache
    RewriteCond %{HTTP_USER_AGENT} ^.*internal\ dummy\ connection.*$ [NC]
    RewriteRule .* - [F,L]

    Still didnt work.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      No, for some reason it thinks you’re trying to access /, the root directory of your server (which of course you can’t). This isn’t an issue of the permissions to files or folders in your web space.

      You’re sure in the Configuration, in the File Manager tab, the first field (File Manager Path) is
      /var/www/sterling/


      This has nothing to do with the paths and URLs configured in the Interface and Features tab; that’s strictly for the resource browser for TinyMCE and TVs.

      The .htaccess in the manager folder should only have the RewriteEngine turned off (or possibly also turning off the mod_security SecFilterEngine in more recent versions). If there were a problem with index.php, then the site wouldn’t work at all unless you specified the index.php in the URL, so this has nothing to do with the DirectoryIndex directive.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 32911
        • 13 Posts
        I am positive,

        I have checked again once I read your post, I know I am totaly confused! I believe that I have every thing correct, remembering that I didnt do the install, I have only been brought in to fix up the mess.

        to confirm the File Manager Path is set to "/var/www/sterling/"

        Can I do anything else to force this function, maybe hard code the path somewere??

        Thanks again.
          • 33372
          • 1,611 Posts
          Susan is probably right. I was thinking that you were seeing this error on trying to load the file manager pop-up. If you’re getting it when trying to upload a file, then it’s definitely not related to URL settings.

          If the setting is appearing as it should in the Configuration page, then it’s been saved correctly (although you could check the value for rb_base_dir in the modx_system_settings table to be sure). Perhaps the script files didn’t upload properly and are corrupted, or it’s possible that you have an error in your PHP environment settings. Check the error logs to see what exactly is going on as far as the server’s concerned.

          Quote from: sottwell at Jul 11, 2009, 03:38 AM

          The .htaccess in the manager folder should only have the RewriteEngine turned off (or possibly also turning off the mod_security SecFilterEngine in more recent versions).
          Just as an aside, I recently had Manager access on a site suddenly fail. Whenever you tried to access the Manager login page, it redirected you to the home page (which is the 401 page on this site). The database tables were all fine, and replacing the cache files did nothing. Checking the error logs led me to remove the SecFilterEngine line from the Manager .htaccess, and it immediately worked again. The error was something about an option for software not installed on this server, so I guess the host changed their PHP environment because it had worked that way for months.
            "Things are not what they appear to be; nor are they otherwise." - Buddha

            "Well, gee, Buddha - that wasn't very helpful..." - ZAP

            Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Do you get access to the File Manger at all (Resources -> Files)? Or are you getting this error when the file manager tries to open in the first place?

            The value you have in the Confguration is what is used to access the file system for the File Manager. Nothing else should be affecting that; it’s directly taken from the siteCache.idx.php, in assets/cache. Open up that file and do a search for filemanager_path and make sure it’s showing the correct path
            $c[’filemanager_path’] = "/var/www/sterling/";
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 32911
              • 13 Posts
              It is when I try and access the file manager that I get the error;

              I have looked at filemanager_path in the siteCache.idx.php file and this is what is there;

              ---------------------------line 59 to 60---------------------------------
              $c[’new_folder_permissions’] = "744";
              $c[’show_preview’] = "0";
              $c[’filemanager_path’] = "/var/www/sterling/";
              $c[’theme_refresher’] = "";
              $c[’manager_layout’] = "4";
              ------------------------------------------------------------------------
              thanks guys
                • 3749
                • 24,544 Posts
                Here’s my theory. For some reason, $filemanager_path is empty by the time it gets to where it’s used. That makes it "/" which makes MODx think you’re trying to access a directory above the MODx root, so it throws you out.

                I’m pretty sure the problem is manifesting in the file manager/actions/files.dynamic.php.

                I think the error is thrown here:

                // check to see user isn't trying to move below the document_root
                if(substr(strtolower(str_replace('//','/',$startpath."/")), 0, $len)!=strtolower(str_replace('//','/',$filemanager_path."/"))) {
                	echo $_lang['files_access_denied']; ?>


                So, if I’m right, something is wrong with either $startpath or $filemanager_path. Back up the file and change the above code to:

                // check to see user isn't trying to move below the document_root
                if(substr(strtolower(str_replace('//','/',$startpath."/")), 0, $len)!=strtolower(str_replace('//','/',$filemanager_path."/"))) {
                //	echo $_lang['files_access_denied']; 
                
                echo 'STARTPATH: ' $startpath . "<br />
                echo 'FILEMANAGER_PATH: ' $filemanager_path . "<br />
                
                ?>


                If $filemanager_path is empty, try putting this line at the top of the file in the //settings section (revert the code above to its original form):

                $filemanager_path = "/var/www/sterling/";


                If that doesn’t work. Start from the original file and try this change around line 100:

                From:

                // get the current work directory
                if(isset($_REQUEST['path']) && !empty($_REQUEST['path'])) {
                        $_REQUEST['path'] = str_replace('..','',$_REQUEST['path']);
                	$startpath = is_dir($_REQUEST['path']) ? $_REQUEST['path'] : removeLastPath($_REQUEST['path']) ;
                } else {
                	$startpath = $filemanager_path;
                }

                To:

                // get the current work directory
                //if(isset($_REQUEST['path']) && !empty($_REQUEST['path'])) {
                //       $_REQUEST['path'] = str_replace('..','',$_REQUEST['path']);
                //	$startpath = is_dir($_REQUEST['path']) ? $_REQUEST['path'] : removeLastPath($_REQUEST['path']) ;
                //} else {
                                $filemanager_path = "/var/www/sterling/";
                	$startpath = $filemanager_path;
                //}


                This might not be a workable solution to your problem, but if it gets you past that first error message it will tell us something. If it does, try uncommenting the other lines (but leave the hard-coded $filemanager_path) and see what happens.

                Hope this makes sense. wink
                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting
                  • 32911
                  • 13 Posts
                  First up bobray and all of you guys thanks for your efforts.


                  I tried the first two suggestions with no luck first created an error at line "echo ’STARTPATH: ’ $startpath . "
                  " second did nothing.

                  THEN (drumroll prlease)

                  // get the current work directory
                  //if(isset($_REQUEST[’path’]) && !empty($_REQUEST[’path’])) {
                  // $_REQUEST[’path’] = str_replace(’..’,’’,$_REQUEST[’path’]);
                  // $startpath = is_dir($_REQUEST[’path’]) ? $_REQUEST[’path’] : removeLastPath($_REQUEST[’path’]) ;
                  //} else {
                  $filemanager_path = "/var/www/sterling/";
                  $startpath = $filemanager_path;
                  //}

                  got me access to the file manager and sort of access to the /sterling/ directory I couldnt move into another directory but I could access files. But I could access all features of themplate variables that I have created.

                  I did try the next sugestion and uncommented all of this code sample, which turned up with this error "Directory listing for:/investors Access denied!" when I tried to change directories.

                  We are on the move. grin
                    • 3749
                    • 24,544 Posts
                    Duh.

                    echo 'STARTPATH: ' $startpath . "<br />
                    echo 'FILEMANAGER_PATH: ' $filemanager_path . "<br />

                    should be:

                    echo 'STARTPATH: ' $startpath . "<br />";
                    echo 'FILEMANAGER_PATH: ' $filemanager_path . "<br />";

                    (Quotes and Semicolons at the end of each line -- I need more sleep). Sorry about that.
                    See what that gives you (you’ll need to revert to generate the original error).

                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting
                      • 32911
                      • 13 Posts
                      I know about the sleep thing! I havent even been realy reading the code that I am inserting.........

                      Any way made the change and this is the error;

                      Parse error: syntax error, unexpected T_VARIABLE, expecting ’,’ or ’;’ in /var/www/sterling/manager/actions/files.dynamic.php on line 291

                      ---------------------------Line 291-------------------------------------
                      echo ’STARTPATH: ’ $startpath . "
                      ";
                      -----------------------------------------------------------------------
                      Cheers
                      Shaun