Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2008
    Posts
    3
    Plugin Contributions
    0

    Default product downloads producing test files

    I have a customer using zen cart 1.3.7.1 to provide downloadable pdf's. Currently the downloads aren't working properly, they are producing what appears at first glance to be a corrupt file.
    Further investigation shows that the content of the file has been replaced with the text "test".
    This happens regardless of whether the file is one of the pdf's that the customer has uploaded or the test.zip file provided with zencart. In all cases the file downloaded has the correct file name, but is an ASCII text file with the word test in it.
    To troubleshoot this one I've setup a test download product following one of the zencart tutrials. I've also verified that the files in the download folder are valid (removed the .htaccess file and downloaded them directly).
    I've tried disabling download by redirect with the same result, I've also tried enabling download by streaming with redirect disabled, again with the same result.

    The server is running apache 2.2 and the site is using php 5.2.5. The pub and download folders are both 755, the site itself is in a chrooted environment so php can read and write to 755 folders. I have tried changing the pub folder to 777 but that hasn't made any difference.
    The configure.php has correct paths for download and pub folders and the Admin page has a green dot next to the downloadable files.

    The fact that the files are being overwritten with a text file containing test suggests that this is some kind test mode in zencart. But I haven't been able to find any thing that would enable / disable that in zencart, nor in any of the setup downloadable product tutorials.
    Customer was testing with the Credit Card payment module and have also tried with PayPal IPN.

  2. #2
    Join Date
    Sep 2008
    Posts
    3
    Plugin Contributions
    0

    Default Re: product downloads producing test files

    *sigh*. Found it, someone had a put die("test"); in includes/modules/pages/download/header_php.php. I'm guessing one of my earstwhile colleagues was trying to debug why the downloads weren't working.

    I think he was trying to determine why Download by redirect wasn't working on the server. Which does bring up an interesting issue that others may encounter.
    This is a Linux server, that allows FollowSymlinks but will not work with Download by redirect, at least not easily. The server software sets up sites in a chrooted environment so the site is completely contained within its' own environment. It's great for security in that php and cgi scripts only run as the site user.
    It also means that the FS root for the site is not the same as the server root. For example the web folder from the server root would be:
    /home/sites/DOMAIN.NAME/var/www/html

    However from inside the chrooted environment the web folder from root is:
    /var/www/html

    This becomes a problem with download by redirect as the zencart must be configured the chrooted web folder root. So when it sets up links for downloads the link is setup as follows:
    pub/.RANDOM/MY_FILE.zip ->/var/www/html/shop/downloads/MY_FILE.zip

    While php and cgi are run as the user from the chrooted environment apache is not. Apache won't be able to follow the link, the only way that would work is if the symlink is setup as follows:
    pub/.RANDOM/MY_FILE.zip ->/home/sites/DOMAIN.NAME/var/www/html/shop/downloads/MY_FILE.zip

  3. #3
    Join Date
    Sep 2008
    Posts
    3
    Plugin Contributions
    0

    Default Re: product downloads producing test files

    actuall on reflection it could be fixe by specifying the download folder as:
    ../../../home/site/DOMAIN.NAME/var/www/html/shop/download

    Awful I know, but it should work in that the sym link would be generated as:
    /var/www/html/../../../home/site/DOMAIN.NAME/var/www/html/shop/download/FILE

    That would be a valid path from the root of the server.

 

 

Similar Threads

  1. Test-store config files
    By jgold723 in forum General Questions
    Replies: 1
    Last Post: 20 Oct 2011, 02:41 PM
  2. I want to test product Downloads with the COD module..but I can't...
    By dgent in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 30 Aug 2011, 03:20 PM
  3. corrupt files (downloads)
    By Faith516 in forum Managing Customers and Orders
    Replies: 1
    Last Post: 21 May 2011, 11:48 PM
  4. downloads, single product with multiple files
    By trillian in forum General Questions
    Replies: 12
    Last Post: 4 Oct 2009, 01:36 AM
  5. Replies: 3
    Last Post: 21 Jul 2009, 07:21 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR