Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Download Controller Symlink Assistance


sublok

Recommended Posts

On a Godaddy VPS. having an issue with the downloads controller. 

 

File is properly set in the product. I ssh'd into the server and its showing the u:g as apache:apache, its not creating a Symlink for the file, so file_exists returns false, 

 

due to server restrictions, chown and chmod have been disabled and I require safe_mode for security reasons. and I cant do direct fallback for readfile because the output of the file being downloaded outputs a custom formatted PDF, which vars are being passed in the redirect.

 

I can get it to echo out error messages, 

 if (DOWNLOAD_BY_REDIRECT == 'true') {
// This will work only on Unix/Linux hosts
    tep_unlink_temp_dir(DIR_FS_DOWNLOAD_PUBLIC);
    $tempdir = tep_random_name();
    umask(0000);
//works making hidden dir
    mkdir(DIR_FS_DOWNLOAD_PUBLIC . $tempdir, 0777);
//not working
    symlink(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'], DIR_FS_DOWNLOAD_PUBLIC . $tempdir . '/' . $downloads['orders_products_filename']);

    if (file_exists(DIR_FS_DOWNLOAD_PUBLIC . $tempdir . '/' . $downloads['orders_products_filename'])) {
      tep_redirect(tep_href_link(DIR_WS_DOWNLOAD_PUBLIC . $tempdir . '/' . $downloads['orders_products_filename'], 'id='.$customer_id .'&token='. $token. '&oToken='. $tokenOrder. '&pid=' .$downloads['pid']));
	  
  //  }else{
echo "no file found";
	}
  }

ideas?

Edited by sublok
Link to comment
Share on other sites

As a follow up 

 

echo '<pre>';
var_dump(exec('whoami'));
echo "Current Script Owner: ".get_current_user()."\n";
 
outputs
string(6) "apache"
Current Script Owner: {username} different that "apache"
 
It appears that Symlink needs to have the same permissions to create a link, Im not sure how to make that happen, So i know its now a permissions issue, does anyone know how to assist?
Edited by sublok
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...