We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4018
    • 1,131 Posts
    I think the problem with the resource browser is one that I had a while back. In some configurations, especially ones that run PHP as CGI, server-side includes may not work right if you use a relative path. So...I think what we need to do is modify the config.php file for the connector of the resource browser to use a full path instead of a relative one. That should do the trick...err...I think! smiley

    Jeff
      Jeff Whitfield

      "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."
      • 17802
      • 190 Posts
      Can you tell me the name of that file? I would like to go and test your hypothesis wink
        Thanks for MODx - I love it!
        • 4018
        • 1,131 Posts
        You sure can, Maaike! I’d like to have this tested before I commit it. Unzip the attached file and overwrite the following file in the following directory:

        /manager/media/browser/mcpuk/connectors/php/config.php

        The change I made entailed changing the includes from this:

        include("../../../../../includes/config.inc.php");


        To something like this:

        include(realpath(dirname(__FILE__))."/../../../../../includes/config.inc.php");


        I think the problem lies in the fact that PHP simply need to know what directory to start the include in...otherwise it will default to whatever is in the php.ini file as the default include path.

        Let me know if this works for ya. If so, I’ll commit it ASAP. smiley

        Jeff
          Jeff Whitfield

          "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."
          • 17883
          • 1,039 Posts
          Hi Jeff,

          sorry doesn´t work for me. What I really don´t understand is that it worked with 0.92 on exactly the same server with the same settings etc...

          Regards and thx for your effords!
            • 17802
            • 190 Posts
            I’m sorry Jeff - no changes here either.
              Thanks for MODx - I love it!
              • 17802
              • 190 Posts
              This is interesting: I just replaced the config.php file with the config file from 0.9.2 and guess what - the image browser works again grin
              Now this is probably not a solid solution, but I think it confirms that the problem is in this file.
                Thanks for MODx - I love it!
                • 17883
                • 1,039 Posts
                Same here.... ! So the initializing of the variables prior to grabbing the config file has something to do with that?!

                Thx Maaike for this "quick" fix smiley
                  • 17802
                  • 190 Posts
                  OK, this is even more weird, but I think I’ve nailed it (?).
                  I just took the original config file from my 0.9.5 download and uploaded it - and it still works. I think this means that there’s nothing wrong with the code, but in some cases the file is damaged during upload or in the install process?

                  Edit: I just compared the file from the ZIP file I downloaded and the original file on my server in Dreamweaver. The file from the server looks different: it seems some returns have disappeared, which turned some lines of code into comments! Like so:
                  File from my server:
                  // load configuration file// initialize the variables prior to grabbing the config file$database_type = '';$database_server = '';$database_user = '';$database_password = '';$dbase = '';$table_prefix = '';$base_url = '';$base_path = '';include("../../../../../includes/config.inc.php");
                  /** 

                  Original file form modxcms.com:
                  // load configuration file
                  // initialize the variables prior to grabbing the config file
                  $database_type = '';
                  $database_server = '';
                  $database_user = '';
                  $database_password = '';
                  $dbase = '';
                  $table_prefix = '';
                  $base_url = '';
                  $base_path = '';
                  include("../../../../../includes/config.inc.php");

                    Thanks for MODx - I love it!
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    Yes, I get that from time to time as well, although more commonly with js files. The FTP client somehow loses the carriage return/line feed, turning the whole file into one line, totally messing up any comment lines. Usually I’ll take the original, convert its line endings to UNIX line endings, and re-upload without any further problem.
                      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
                      • 4018
                      • 1,131 Posts
                      So...does it work once the carriage returns are fixed?
                        Jeff Whitfield

                        "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."

                      This discussion is closed to further replies. Keep calm and carry on.