Author Topic: Uploadign of files error  (Read 28593 times)

soomon

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
    • Email
Re: Uploadign of files error
« Reply #30 on: November 16, 2008, 06:45:06 pm »
hi,

it sais: Failed to create folder '.../opengoo/upload/fc5dc/4e05b/d19a2'

but i checked and all these folders exist...
including some more that also seem to be created by opengoo (from earlier tries i guess..)
but there are no files in there

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: Uploadign of files error
« Reply #31 on: November 17, 2008, 09:51:11 am »
And what about error messages in "cache/log.php"? Clear the log first (delete the file) and then try uploading a document to isolate the error message.

Thanks.

soomon

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
    • Email
Re: Uploadign of files error
« Reply #32 on: November 17, 2008, 10:01:01 am »
that's the strange thing... i dont get any error messagein the log file any more....
i dont know why...
maybe this new function you mentioned in you last post doesn't log the error?

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: Uploadign of files error
« Reply #33 on: November 18, 2008, 09:02:00 am »
The last resort since we couldn't solve this problem is to use the database file repository. You can set this up in Administration / Configuration / General / File Storage.

j_strackbein

  • Freshman
  • *
  • Posts: 10
    • View Profile
    • WISER: Water bodies in Europe, Intergrative System to access Ecological status and Recovery
    • Email
Re: Uploadign of files error
« Reply #34 on: November 21, 2008, 11:33:06 am »
I have the same problems like lots of others here, I can not upload any files, the log.php shows the problem with the open_basedir settings. I have tried to follow all the recipes in the forum but noting works..
Database storage is no option because of the large amount of files.

All other PHP-packages I use on the same host can write, upload files, can create subfolders etc. without any problems.. eg. Mambo, Joomla, Propel, Quixplorer... some of them using a repository like opengoo too.

What I do not understand is the error message itself, if I understand the open_basedir setting of the server correct it is restricting scripts to my path only or? this look correct to me...

The Hoster is linking  "www.my_domain.eu" to "/is/htdocs/my_custom_number/www/", opengoo is runing in "www.my_domain.eu/intranet/",
open_basedir settings of the server are "/is/htdocs/my_custom_number", which should  include all subfolder , or?

But when opengoo is trying to create a new subfolder the error_log says it is OUTSIDE of the allowed path..??

Is there maybe someting wrong with relative/absolute path settings somewhere..?


#1 ERROR: Error: is_dir() [<a href='function.is-dir'>function.is-dir</a>]:
open_basedir restriction in effect.
File(/is) is not within the allowed path(s): (/is/htdocs/user_tmp/my_custom_number:/tmp:/dev/null:/bin:/usr:/is/default.errors:/is/htdocs/my_custom_number) in '/is/htdocs/my_custom_number/www/intranet/environment/functions/files.php' on line 241 (error code: 2)

#2 ERROR: mkdir() [<a href='function.mkdir'>function.mkdir</a>]:
open_basedir restriction in effect.
File(/is) is not within the allowed path(s): (/is/htdocs/user_tmp/my_custom_number:/tmp:/dev/null:/bin:/usr:/is/default.errors:/is/htdocs/my_custom_number) in '/is/htdocs/my_custom_number/www/intranet/environment/functions/files.php' on line 243 (error code: 2)

The first impression of opengoo was soo good, we would like to use it in a large scientifc project, but therefore it should run without any trouble.. are there some examples of a large installations somewhere, someone who has experience with 50-100users?

thanks and greetings from vienna

soomon

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
    • Email
Re: Uploadign of files error
« Reply #35 on: November 21, 2008, 11:48:44 am »
that's also what i can't understand, too.

does opengoo create the directories?
in my case it said is couldn't but the directories have been created.

normally opengoo should not try to write without it's own path..

and yes, those restrictions on open_basedir are totally correct and needed for security reasons!

<german>k.a. wo da sproblem liegt.. muss aber einer der progger lösen, hoffe auch die bekommend as in den griff :S</german>
« Last Edit: November 21, 2008, 11:51:26 am by soomon »

j_strackbein

  • Freshman
  • *
  • Posts: 10
    • View Profile
    • WISER: Water bodies in Europe, Intergrative System to access Ecological status and Recovery
    • Email
Re: Uploadign of files error
« Reply #36 on: November 21, 2008, 05:44:43 pm »
I am not a php genius at all, but with a help of a friend we have maybe found what causes the problem, can someone (the developers) please check this:

We think it is NOT the openbase_dir setting, this seems to be correct for us.

The error ocurs in the "function force_mkdir" in line 241 ff. in /enviroment/functions/files.php when the path is read and opengoo is trying to creat a new folder.

In my case the path to webdir is "/is/htdocs/my_customer_number/www/" .

in line 242  of files.php

"if(!mkdir($forced_path)) return false;"

causes the error because $force_path is "/is" in the first loop of foreach and it is not allowed there to create a folder or to doing anything else.

So I think mkdir starts much to high in the path, it must start below /is/htdocs/my_customer_number//www/ in my case but I do not completly understand why you this function like the way it works. At the moment the loop reaches the part of the path which is writable for me it works, so when I add a 

&& strstr($forced_path, "/is/htdocs/my_customer_number/www" in line 240

it works fine and I can add any file I want. But does this cause any trouble with other functions?



soomon

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
    • Email
Re: Uploadign of files error
« Reply #37 on: November 21, 2008, 05:53:37 pm »
can't one set this force path to the opengoo path and add an /upload to it?
isn't it as simple as that?
« Last Edit: November 22, 2008, 08:46:05 am by soomon »

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: Uploadign of files error
« Reply #38 on: November 22, 2008, 01:24:02 pm »
Hi,

We'll look at this issue for next release. All the testing feedback you can give us will be appreciated.

Thanks.

soomon

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
    • Email
Re: Uploadign of files error
« Reply #39 on: November 22, 2008, 01:31:25 pm »
some fix for this release would be great...
that'Äs the most important function i currently miss :S

soomon

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
    • Email
Re: Uploadign of files error
« Reply #40 on: November 22, 2008, 02:29:50 pm »
At the moment the loop reaches the part of the path which is writable for me it works, so when I add a 

&& strstr($forced_path, "/is/htdocs/my_customer_number/www" in line 240

it works fine and I can add any file I want.


i am sorry but line 240 is:            } // if
at least when i look into my files.
can ypu please post the file you modified and how it should look like after the modification?

tanks!

j_strackbein

  • Freshman
  • *
  • Posts: 10
    • View Profile
    • WISER: Water bodies in Europe, Intergrative System to access Ecological status and Recovery
    • Email
Re: Uploadign of files error
« Reply #41 on: November 23, 2008, 01:50:28 pm »
First @developers: you have done a wounderful job!!! Thanks, it is a great looking product and if we are going to use it in our large research project, we will make a lot of advertising for opengoo :-)

This force_mkdir function could be changed even more, or? As I mention before I am not a PHP guru at all, maybe someone else out there could be so nice :-) I have 2 questions:

Replaceing the backslashes is only needed on Windows-System (right?) and I would guess that 90% of the webservers are Unix.. select case Unix/Win?

Why is the loop spliting the path into pieces and then starts trying all this pieces? is the upload folder not always in "/opengoo_install_dir/upload" ? Why not start just below that?


Here is the complete function including my addtion which works with my Hoster:

/**
  * Force creation of all dirs
  *
  * @access public
  * @param void
  * @return null
  */
  function force_mkdir($path, $chmod = null) {
    if(is_dir($path)) return true;
    $real_path = str_replace('\\', '/', $path);
    $parts = explode('/', $real_path);
    $forced_path = '';
    foreach($parts as $part) {
        if($part !='')
        {
              // Skip first on windows
              if($forced_path == '') {
                $start = substr(__FILE__, 0, 1) == '/' ? '/' : '';
                $forced_path = $start . $part;
              } else {
                $forced_path .= '/' . $part;
              } // if
              if(!is_dir($forced_path) && strstr($forced_path, "/is/htdocs/my_custumer_number/www")) {
                if(!is_null($chmod)) {
                  if(!mkdir($forced_path)) return false;
                } else {
                  if(!mkdir($forced_path, $chmod)) return false;
                } // if
              } // if
        } // if
    } // foreach
    return true;
  } // force_mkdir

soomon

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
    • Email
Re: Uploadign of files error
« Reply #42 on: November 23, 2008, 02:29:50 pm »
Why is the loop spliting the path into pieces and then starts trying all this pieces? is the upload folder not always in "/opengoo_install_dir/upload" ? Why not start just below that?

that's exactly what i thin, too ...

soomon

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
    • Email
Re: Uploadign of files error
« Reply #43 on: November 23, 2008, 03:23:30 pm »
Here is the complete function including my addtion which works with my Hoster...

works!

danke!! bist mein held  ;D

« Last Edit: November 23, 2008, 03:28:10 pm by soomon »

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: Uploadign of files error
« Reply #44 on: November 26, 2008, 11:02:18 am »
Hi,

Try changing the contents of function force_mkdir, on line 225 of environment/functions/files.php so that you end up with this:

Code: [Select]
function force_mkdir($path, $chmod = null) {
return mkdir($path, $chmod, true);
} // force_mkdir

This patch was submitted by Gennady Telegin, who had the same problem, and this fixed it. Thanks Gennady!