Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

problem with openfile() in download feature


Recommended Posts

First off, I searched for a previous post on this topic before posting here but could not find anything to help me solve this problem.


I sell files for download, and my site has been working fine for months. I'm now moving to a new server and I get the following error when the server tries to create the temporary directory and file for the download:

Warning: opendir(): SAFE MODE Restriction in effect. The script whose uid is 508 is not allowed to access /home/virtual/site3/fst/var/www/html/catalog/pub owned by uid 0 in /home/virtual/site3/fst/var/www/html/catalog/includes/modules/downloads.php on line 37


Warning: opendir(/home/virtual/site3/fst/var/www/html/catalog/pub//76): failed to open dir: No such file or directory in /home/virtual/site3/fst/var/www/html/catalog/includes/modules/downloads.php on line 37

safemode is set to off in php.ini and the pub directory is set to 777.


Any ideas as how to fix this error?

Link to comment
Share on other sites

looks like a configure.php file error (catalog/pub//76)

also with safe mode, u should probably go to another host

Link to comment
Share on other sites

Line 37 is checking if the file exists in the download directory and your error shows pub so like said check your config.


Still I dont think it will work in safemode because creating the directory will be owned by apache and you will get the same error trying to create the link.


You could turn off the download by redirect and change the readfile section like below to overcome the script memory limit problem.



readfile(DIR_FS_DOWNLOAD . $downloads['orders_products_filename']);



if (!$handle = @fopen(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'], 'rb')) die;
while (!feof($handle)) echo fread($handle, 4096);


You could also rework the redirect method from temdir/filename to tempdir_filename so no directory involved.

Link to comment
Share on other sites

It looks like you have Ensim CP. If so then you cqan change thesecurity setting for the domain compatable to high. This will turn off safe mode and virtualize your paths.






will become




You will have to change your admin settings and config settings.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...