Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Fatal error: The root configuration file could not be found/read (_config.xml) [solved]

edited August 2005 in Vanilla 1.0 Help
For some reason I'm getting this error and I can't figure out why. I've chmoded the files like the docs says, and i've even tried to chmod everything 0777.. Any suggestions? Need more info?
«1

Comments

  • it could be something to do with the ownership of the files. You could try chown-ing them to the apache user (usually either apache or web or httpd). But if you dont have high level access to your server i'd suggest you avoid this if you can since it will be near impossible to get the ownership back. I'm pretty sure 777 should work. Hmm...
  • MarkMark Vanilla Staff
    is this an upgraded version of the filebrowser? If so, you should note that the config file name has changed, and you may have a previously existing .config.xml file instead of the new _config.xml Also, do you have a url and your php version available?
  • It's a clean install. Check out http://www.ghettonesna.org/gallery/phpinfo.php for the phpinfo
  • (grimzy@nocturnal:/home/www/ghettonesna.org/htdocs/gallery) ls -la total 174 drwxrwxrwx 3 grimzy grimzy 512 Aug 29 11:24 ./ drwxr-xr-x 5 grimzy grimzy 512 Aug 29 10:55 ../ -rwxrwxrwx 1 grimzy grimzy 109 May 6 2004 _clipboard.swf* -rwxrwxrwx 1 grimzy grimzy 1114 Jul 22 07:46 _config.xml* -rwxrwxrwx 1 grimzy grimzy 1856 Jan 8 2004 _corner_br.gif* -rwxrwxrwx 1 grimzy grimzy 1861 Jan 8 2004 _corner_tl.gif* -rwxrwxrwx 1 grimzy grimzy 5780 Jul 19 10:48 _default.css* -rwxrwxrwx 1 grimzy grimzy 982 Jun 21 21:10 _filetypes.xml* -rwxrwxrwx 1 grimzy grimzy 18009 Feb 2 2005 _gpl.txt* -rwxrwxrwx 1 grimzy grimzy 2985 Jul 9 23:18 _thumbnailer.css* -rwxrwxrwx 1 grimzy grimzy 58312 Jul 22 07:39 index.php* drwxrwxrwx 3 grimzy grimzy 512 Aug 29 10:56 misc/ -rw-r--r-- 1 grimzy grimzy 19 Aug 29 10:23 phpinfo.php -rwxrwxrwx 1 grimzy grimzy 8118 Jul 15 13:44 readme.html* -rwxrwxrwx 1 grimzy grimzy 62851 Jul 19 10:24 thumbnailer.php* As you see, _everyone_ should have access to these files..
  • edited August 2005
    Could it be that getcwd is returning null on OpenBSD as the user running PHP doesn't have read access to all of the parent directories? As per: http://bugs.php.net/bug.php?id=24185 Try creating a PHP file like: <?php $path =getcwd(); if($path){ echo $path; }else{ echo "Getcwd returns false"; } ?> and see what the result is.
  • Looks like you're right! "Getcwd returns false" (http://www.ghettonesna.org/gallery/getcwd.php)
  • Can i replace getcwd() with my gallery-path then or will that mess things up?
  • edited August 2005
    Try doing that and seeing if it works, I was having a quick browse through trying to see if it uses getcwd on each recursion but come to think of it that wouldn't make sense so maybe explicitly setting it will work. So find the line: $this->CurrentWorkingDirectory = getcwd(); and set it isntead of calling getcwd, if that works then a cleaner solution would be to create a new function that does: function alt_getcwd{ $temp_path = $_SERVER["SCRIPT_FILENAME"]; $spot = strrpos($_SERVER["SCRIPT_FILENAME"], "/"); $local_path = substr($temp_path, 0, $spot); return $local_path; } and call that instead. NOTE: I don't even use FileBrowser yet for anything, I'm just pitching in trying to help so your mileage may vary. :)
  • I just realized the thumbnailer also calls getcwd in a couple of places so if you are creating thumbnails you will have to change it there as well.
  • Neither of them worked, but thanks for trying though :) Lemme know if I can give you some what more 'debug' info
  • MarkMark Vanilla Staff
    edited August 2005
    Hmmm. That is strange.

    So wait, you tried changing the cwd with your root path and that failed as well? Are you sure you got the correct path?

    I think the next thing to try is going into the code and allowing it to spit out the actual errors that it is encountering so we can see what's really going on.

    Open up your index.php file and on line 501 change this:
    function Get($File) {
    	// Ensure required properties are set
    	$FauxContext = 0;
    	if ($File->Name == "") $this->ErrorManager->AddError($FauxContext, $this->Name, "Get", "You must supply a file name.", "", 0);
    	if ($File->Path == "") $this->ErrorManager->AddError($FauxContext, $this->Name, "Get", "You must supply a file path.", "", 0);
    	if ($this->ErrorManager->ErrorCount == 0) {
    		$File->Extension = $this->FileExtension($File);
    		$FilePath = $this->FilePath($File);
    		$FileHandle = @fopen($FilePath, "r");
    		if (!$FileHandle) {
    			$this->ErrorManager->AddError($FauxContext, $this->Name, "Get", "The file could not be opened.", $FilePath, 0);
    		} else {
    			$File->Size = filesize($FilePath);
    			$File->Body = @fread($FileHandle, $File->Size);
    			if (!$File->Body) $this->ErrorManager->AddError($FauxContext, $this->Name, "Get", "The file could not be read.", "", 0);
    			@fclose($FileHandle);
    		}
    	}
    	return $this->ErrorManager->Iif($File, false);
    }
    To This:
    function Get($File) {
    	// Ensure required properties are set
    	if ($File->Name == "") {
    		echo("You must supply a file name.");
    		die();
    	}
    	if ($File->Path == "") {
    		echo("You must supply a file path.");
    		die();
    	}
    	$File->Extension = $this->FileExtension($File);
    	$FilePath = $this->FilePath($File);
    	$FileHandle = fopen($FilePath, "r");
    	if (!$FileHandle) {
    		echo("The file could not be opened.");
    		die();
    	} else {
    		$File->Size = filesize($FilePath);
    		$File->Body = fread($FileHandle, $File->Size);
    		if (!$File->Body) {
    			echo("The file could not be read.");
    			fclose($FileHandle);
    			die();
    		}
    	}
    	return $File;
    }

    Be sure to save your original file so that once we figure out what the problem is, you can put it back the way it was.
  • edited August 2005
    Err, my bad guys, the path did work after all , just had a typo. However, the tumbnailer isn't working. When i try to open a image that's in the "car-accident"-folder it tries to open it from "ar-accident" (just check the source for your self at http://www.ghettonesna.org/gallery/index.php?fpp=10&did=0&fid=1) Weird
  • You need to make the changes in thumbnailer.php as well.
  • I've done it both places in thumbnailer, but still no luck $this->CurrentWorkingDirectory = "/home/www/ghettonesna.org/htdocs/gallery/"; (I also tried without a / at the end, but same result)
  • MarkMark Vanilla Staff
    hmm - well, the thumbnailer seems to be working fine, so the problem is only happening in the filebrowser (I was able to thumbnail all of your images in both folders). I'm not sure why that is happening - but just for the sake of it, try removing the "-" from "car-accident" and see if that fixes it. I don't see why specifying your own cwd should break that, so it might have something to do with the folder name.
  • Hmm, same result. It's removing the first char from the dir-name. I've cp'd both files so you can see that I haven't (or maybe I have) done anything wrong http://www.ghettonesna.org/index.php.txt http://www.ghettonesna.org/thumbnailer.php.txt
  • edited August 2005
    What you are experiencing would happen if you kept the trailing slash that is currently there, can you try removing the trailing slash from anywhere you have your directory specified, clear your browser cache and then try again? Alternatively on the end of index.php you can add something like &reallyrefresh and that in most cases will force a refresh.
  • MarkMark Vanilla Staff
    I'm pretty sure that the problem lies in the FormatDisplayedItem function on line 540 of the index.php file, so let's find out if I'm right.

    Change this:
    function FormatDisplayedItem($ItemID, $FileName, $FileSize, $HandlerMethod, &$Params, $Config) {
       $FolderPath = substr($Config->CurrentBrowsingDirectory, strlen($Config->CurrentWorkingDirectory)+1,(strlen($Config->CurrentBrowsingDirectory)-strlen($Config->CurrentWorkingDirectory)+1));
    To this:
    function FormatDisplayedItem($ItemID, $FileName, $FileSize, $HandlerMethod, &$Params, $Config) {
       echo("CurrentWorkingDirectory: " . $Config->CurrentWorkingDirectory);
       echo("<br />CurrentBrowsingDirectory: " . $Config->CurrentBrowsingDirectory);
       $FolderPath = substr($Config->CurrentBrowsingDirectory, strlen($Config->CurrentWorkingDirectory)+1,(strlen($Config->CurrentBrowsingDirectory)-strlen($Config->CurrentWorkingDirectory)+1));
       echo("<br />FolderPath: " . $FolderPath);
    Then go to your filebrowser in your web browser.
    Click on that car-accident folder.
    Click on the first image.
    And tell me what it writes to the screen.
  • CurrentWorkingDirectory: /home/www/ghettonesna.org/htdocs/gallery/ CurrentBrowsingDirectory: /home/www/ghettonesna.org/htdocs/gallery/accident FolderPath: ccident (http://www.ghettonesna.org/gallery)
  • MarkMark Vanilla Staff
    Okay, try this:

    Where you changed the getcwd(); to your actual directory, remove the trailing slash, so it becomes:

    $this->CurrentWorkingDirectory = "/home/www/ghettonesna.org/htdocs/gallery";
This discussion has been closed.