Hi There,

im getting this error everytime i try to download files .


    * warning: tempnam(): open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/srv/www/htdocs/site102:/usr/local/php-bin) in /srv/www/htdocs/site102/sites/all/modules/custom/pclzip/pclzip.module on line 95.
    * PCLZIP_ERR_READ_OPEN_FAIL (-2) : Unable to open archive '' in wb mode

I have had a look at line 95 in the code and can't seem to see where to make the changes.
My drupal default temporary folder was set to : /srv/www/htdocs/site102

Comments

ssm2017 Binder’s picture

hello
thank you for your report
the script is using the php function tempnam() http://php.net/tempnam
i dont know yet how to prevent this error
what php version are you using ?
is the user www-data have write / read access to this temp folder ?

tenx’s picture

Php version 5.

The problem is that the module assume that the path to the temporary directory is "/tmp" or "../tmp", it then works fine . But when the path is changed to something other than "/tmp", it throws up that error.
Now i can't change the path myself because i have no access to installation files, and the dudes that host the site will not want to change the path .

So if there is way of stopping the module assuming that everyone will have their temporary file directory set as "/tmp", then i think the error will go away.

ssm2017 Binder’s picture

the problem is not in this module
the problem is in the main module pclzip ( pclzip/pclzip.module on line 95. )

the php version should be >=5.2.1
as you can see in line 95 :

$pclzip_temp_file = tempnam(sys_get_temp_dir(), $filename);

the function is using tempnam and also sys_get_temp_dir() http://php.net/sys_get_temp_dir

the module doesnt define nowhere that the temp dir has to be /tmp, this is automatically done by the php config
but your problem is not saying that the module cannot find the temp dir, the problem looks like a permission problem :
"warning: tempnam(): open_basedir restriction in effect. File(/tmp) is not within the allowed path(s)"

if you want, i can add the ability to add a custom temp folder in the admin options
or
try to replace :

$pclzip_temp_file = tempnam(sys_get_temp_dir(), $filename);

with

$pclzip_temp_file = tempnam(file_directory_temp(), $filename);
tenx’s picture

Oops forgotten there was two modules that allow this functionality. i should have checked the other module.The fix you provided up there seems to work. It now works w/o problems.
Although i noticed that when one creates a views of type file , this module doesn't work . i dont think it is supported .

ssm2017 Binder’s picture

thank you for testing, i will update the version to embed this modification

this module is only working for views type node
if you want you can build one for view type file
im waiting for your answer before trying to create one :)

tenx’s picture

it's all good.

Regarding building one for view type file, maybe once im done with this site im building, which wont be done till august or september.

I will keep reporting any errors with this one though.

ssm2017 Binder’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.