This article will demonstrate how to sell downloads while reducing bandwidth usage and prevent the file's source URL from being displayed.
The problem: Using too much bandwidth...
If you sell downloads, bandwidth consumption is a major concern. Every time a file is downloaded from a website, bandwidth is used to transfer the file data from the server to the user. Downloading a ten megabyte file will use ten megabytes of bandwidth — so if you're selling downloadable movies, or other large media files, the bandwidth adds up fast! |
|
|
|
|
One of the advanced features of Modular Merchant's digital delivery system is that the files being sold aren't required to be hosted by Modular Merchant — they can be hosted anywhere.
For example, I can have my shopping cart and website hosted by Modular Merchant, but my hundreds of gigabytes of downloads hosted with a different host that specialized in file hosting with oodles of bandwidth for downloads. So, having my shopping cart hosted by Modular Merchant and my files downloaded from "Bulk File Hosting, Inc." solves the problem of bandwidth consumption, right? |
No. Actually, this only solves half the problem.
The shopping cart software's digital delivery system is designed to prevent the downloaded file's source URL from being displayed. In order to do this, downloads hosted on a remote server must pass through the store. Thus, to the customer, the file is seen as coming from the store's download area — no matter where it is actually hosted.
The downside of this anti-piracy security mechanism is that, by streaming the file back through the shopping cart server, bandwidth is used on that server too when files are downloaded. So, we're right back where we started: even though our files are hosted on a remote server, downloads are still consuming bandwidth on the store server.
Fortunately, a very simple solution is available.
The solution: Modular Merchant's mm_fileserver.php "Helper File"...
|
|
Modular Merchant provides a "helper file", titled "mm_fileserver.php", that you can upload to all the directories on a remote server that hosts your downloads. By simply uploading this file to the directories that contain your downloads, downloads will stop using your store's bandwidth! This "mm_fileserver.php" file can be used on any server, whether it is a Modular Merchant server or not. |
The mm_fileserver.php file contains a mini version of the software used by the store for downloading files while preventing the file's URL from being displayed. When the shopping cart connects to a remote server, the first thing it does is check for the presence of an mm_fileserver.php file in the directory containing the file to be downloaded.
If an mm_fileserver.php file is found, then the store passes the download duties over to the mm_fileserver.php file, allowing it to complete the download process itself. This means that the remote server is able to perform the download without streaming the file back through the shopping cart server, thus removing the shopping cart from the download chain and not using any of the shopping cart server's bandwidth!
By simply uploading the mm_fileserver.php file to the directory that includes my downloads, I've cut my bandwidth consumption in half. Now, all of the bandwidth consumed by the downloads I sell comes only from the "Bulk File Hosting, Inc." file server.
Download the mm_fileserver.php Helper File...
system requirements
System Requirements for the "mm_fileserver.php" file:
In order to take advantage of the "mm_fileserver.php" file, the third-party server must meet the following system requirements:
1. You must be subscribed to the Modular Merchant Gold account plan or higher. (Remotely hosted downloads are not supported by the Bronze or Silver account plans.)
2. The server must be able to run PHP files.
3. The server must have Zend Optimizer/Guard installed. (It's free.)
4. The file server must provide static (not dynamic) URLs for the files .
For example: http://www.MyFileServer.com/files/MyFile.zip is compatible, but http://www.MyFileServer.com?file=123456 may not be.
5. Upload the "mm_fileserver.php" file in binary file format, not ASCII.
6. The "mm_fileserver.php" file must be placed in the same directory as the files to be downloaded. If you have multiple directories on your server containing downloads, upload a copy of the "mm_fileserver.php" file to each one of those directories.
a note about password protected directories
Password protected directories
For the Bandwidth Conscious:
Note that if the directory containing the downloads is password protected, then resources on the shopping cart server will still be needed in order to securely download the files, which will require store bandwidth to be used. This is because files housed within a password protected directory must be accessed and distributed in a different way by the store's digital delivery system in order to remain secure.
More info on password protected directories is available in this forum article:
http://forums.modularmerchant.com/viewtopic/510/
Testing the mm_fileserver.php installation...
After the mm_fileserver.php file has been uploaded to the directory containing your downloads, testing it to make sure it is installed correctly is easy. To test it, simply enter its URL in a web browser.
If the mm_fileserver.php file is present, and the server meets the system requirements, the following message will be displayed:
mm_fileserver.php output:
Modular Merchant v3 mm_fileserver.php Helper File.
If you can read this message, then it means that this server:
1. Can parse PHP files
2. Has Zend Optimizer installed and configured correctly
If you see that message when viewing the mm_fileserver.php file in a web browser, then it is installed and ready to use!
Troubleshooting common problems...
This section lists some common problems that may be encountered during the initial installation and configuration of an mm_fileserver.php file on a third-party web server:
Problem: A "404 - Page Not Found" message is displayed when viewing the mm_fileserver.php file.
Solution: The mm_fileserver.php file is not present in the website directory. Check the location directory structure on the web server, and upload the mm_fileserver.php file to each of the directories that contain files to be downloaded.
Problem: The message "Fatal error: Unable to read 12345 bytes in /path/to/the/file/mm_fileserver.php on line 0" is displayed when viewing the mm_fileserver.php file.
Solution: The mm_fileserver.php file was not uploaded in binary file format. (It was likely uploaded in "ASCII" or "plain text" file format.) Check the settings of the FTP program you're using and upload the mm_fileserver.php file again, making sure it is uploaded in binary file format.
Problem: A message like "You have attempted to execute a CGI, ISAPI, or other executable program from a directory that does not allow programs to be executed" is displayed when viewing the mm_fileserver.php file
Solution: The mm_fileserver.php file is present, but does not have permission to run. Check the permisison settings of mm_fileserver.php file on the server, making sure it has the correct read/write/execute permission settings.
Problem: The message "Error message: Zend optimizer not installed" is displayed when viewing the mm_fileserver.php file.
Solution: The Zend engine is either not installed, out of date, or not configured correctly on the server. Contact the server facility to have Zend installed or updated.
Problem: Instead of the expected file, a 0 Kb "mm_fileserver.html" file is downloaded.
Solution: The most common cause of this problem is spaces in the name of the download file. (Example: "my file to download.zip") Many servers and web browsers have trouble working with files with spaces in the name. The solution is to change the spaces in the file name to underscores. (Example: "my_file_to_download.zip")
Problem: My download stops midway during the download process.
Solution: This is typically encountered with downloads several hundred megabytes or larger in size. Prematurely ending the download process is usually due to the remote host severing the connection. Some hosts configure their servers to perform "system cleanup" every 30 minutes or so. This cleanup may include closing connections that have been open for a certain period of time. If a download is so large that it requires more time to download than allowed by the system cleanup, the remote server may close the connection before the download has finished.
Problem: My files download correctly from one server, but don't download correctly from another server.
Solution: There's many different ways in which a server can be configured. It is possible that the way a server is configured may make it incompatible with the store's digital delivery system. The setup and config of third-party servers is out of Modular Merchant's control. If a download stops working on a remote server, the first step will be to check with the facility that manages that server.
Problem: All my files larger than a certain size won't download, but smaller files will.
Solution: Check the server to see if PHP is running in "safe mode", and take it out of safe mode if possible. Otherwise, make sure that the server allows scripts to use PHP's set_time_limit() function.
This may also be caused by a bug in certain versions of PHP that affects the way that large files are read off the server. If you suspect this is affecting your files, contact Modular Merchant for an alternative version of the mm_fileserver.php file, which may be able to prevent the download of large files from failing.
Problem: I've confirmed that the mm_fileserver.php file is in place on my server and installed correctly, but downloads are still using my store's bandwidth.
Solution: Check to make sure that the clock on the server that is hosting the mm_fileserver.php file is set correctly. When the mm_fileserver.php file receives the request to download a file, it authenticates the date of the request, to ensure that it is valid. One of these authentications is to check the age of the request. If it is too old, the mm_fileserver.php file will decline it. (This is a security feature to prevent thieves from posting a download link on their website for others to download for free. Such a link would no longer work once it gets too old.) If the clock on the server is running too fast, then the legitimate download requests from the store will be routed back through the store, because the server's inaccurate clock makes the mm_fileserver.php file think that they are old outdated requests.
|