OK I have switched from filestore to filestore2.

In an earllier post with filestore http://drupal.org/node/view/8790 I was getting this:"warning: fopen(): open_basedir restriction in effect" etc. and the upload stopped.

With filestore2 I get a similar warning:
warning: md5_file(): open_basedir restriction in effect. File(/tmp/phpyYSClw) is not within the allowed path(s): (/home/easyloss/:/home/admin/) in /home/easyloss/path/to/drupal/modules/fscache.module on line 146.

but the upload proceeds and the file is available for download.

Following the advice here: http://drupal.org/node/view/8654 I corrected the error: Unknown column 'n.sticky' in 'order clause' query

but the "warning: md5_file(): open_basedir restriction in effect" error persists when uploading a new file.

Any suggestions please?

Noel

Comments

giangiacomo’s picture

System used Drupal 4.6, I cannot use 4.7 for MySQL incompatibility... I can use only 3.x!!!

Hi, I tried to solve your same problem, i found that the function md5_file() does NOTHING IMPORTANT...

function md5_file($file_name){
	if (!file_exists($file_name)) {
        trigger_error('md5_file(): Unable to open file', E_USER_WARNING);
     } else {
        $file_string = implode('', file($file_name));
        return md5($file_string);
     }
  }

You have the php.ini set with open_basedir... so the php's core function file_exist() does not run... the solution is to KILL that function and everytime Drupal calls md5_function() you must only write

original way:
$md5_string = md5_file($original_str);

solution:
$md5_string = md5($original_str);

... keep it simple... :) don't worry... I cried on this problem for 2 days... aaaargghhhh!!

Another problem is in fscache.module at line 174-175...

174 |    //if ($fh = fopen(_fscache_get_cache_name($fsitem->cachename), "rb")) {
175 |    if ($fh = file_get_contents(_fscache_get_cache_name($fsitem->cachename), "rb")) {

because in line 176 Drupal calls the php's core function called: fpassthru()

Now... in php documentation there is specified that this function requires a POINTER of file and NOT a file... so fscache system fails files downloads...

read this: http://it.php.net/manual/en/function.fpassthru.php

Reads to EOF on the given file pointer from the current position and writes the results to the output buffer.

If an error occurs, fpassthru() returns FALSE. Otherwise, fpassthru() returns the number of characters read from handle and passed through to the output.

The file pointer must be valid, and must point to a file successfully opened by fopen() or fsockopen() (and not yet closed by fclose()).

You may need to call rewind() to reset the file pointer to the beginning of the file if you have already written data to the file.

If you just want to dump the contents of a file to the output buffer, without first modifying it or seeking to a particular offset, you may want to use the readfile(), which saves you the fopen() call.

Bye...