clp698 Posted January 9, 2006 Posted January 9, 2006 I want to make MP3 files available. They are anywhere from 8M - 16 M. I realize that the php.ini file limits downloads to 8M and to overcome this I will need a dedicated server. To be sure, I have set up a test system on my own computer. I have edited the php.ini file changing the max download to 20M. Seen below are all the settings. Downloads work, but every file is cut off at 1.9 Megs. Anyone know why? allow_call_time_pass_reference Off Off allow_url_fopen On On always_populate_raw_post_data Off Off arg_separator.input & & arg_separator.output & & asp_tags Off Off auto_append_file no value no value auto_globals_jit On On auto_prepend_file no value no value browscap no value no value default_charset no value no value default_mimetype text/html text/html define_syslog_variables Off Off disable_classes no value no value disable_functions no value no value display_errors On On display_startup_errors Off Off doc_root no value no value docref_ext no value no value docref_root no value no value enable_dl On On error_append_string no value no value error_log no value no value error_prepend_string no value no value error_reporting 2039 2047 expose_php On On extension_dir ./ ./ file_uploads On On highlight.bg #FFFFFF #FFFFFF highlight.comment #FF8000 #FF8000 highlight.default #0000BB #0000BB highlight.html #000000 #000000 highlight.keyword #007700 #007700 highlight.string #DD0000 #DD0000 html_errors On On ignore_repeated_errors Off Off ignore_repeated_source Off Off ignore_user_abort Off Off implicit_flush Off Off include_path .:/usr/local/php5/lib/php .:/usr/local/php5/lib/php log_errors On On log_errors_max_len 1024 1024 magic_quotes_gpc Off Off magic_quotes_runtime Off Off magic_quotes_sybase Off Off mail.force_extra_parameters no value no value max_execution_time 30 30 max_input_time 60 60 open_basedir no value no value output_buffering 4096 4096 output_handler no value no value post_max_size 20M 20M precision 14 14 register_argc_argv Off Off register_globals On On register_long_arrays On On report_memleaks On On report_zend_debug On On safe_mode Off Off safe_mode_exec_dir no value no value safe_mode_gid Off Off safe_mode_include_dir no value no value sendmail_from no value no value sendmail_path /usr/sbin/sendmail -t -i /usr/sbin/sendmail -t -i serialize_precision 100 100 short_open_tag On On SMTP localhost localhost smtp_port 25 25 sql.safe_mode Off Off track_errors Off Off unserialize_callback_func no value no value upload_max_filesize 20M 20M upload_tmp_dir no value no value user_dir no value no value variables_order GPCS GPCS xmlrpc_error_number 0 0 xmlrpc_errors Off Off y2k_compliance On On zend.ze1_compatibility_mode Off Off
user99999999 Posted January 9, 2006 Posted January 9, 2006 If you are not using download by redirect the php setting memory_limit is what causes the problem due to the readfile() function in download.php, you need to change it like below. http://www.oscommerce.com/forums/index.php?showtopic=166892 $chunksize = 32 * 1024; $buffer = ''; $handle = fopen(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'], 'rb'); if ($handle === false) { echo 'ERROR...'; die; } while (!feof($handle)) { $buffer = fread($handle, $chunksize); echo $buffer; } fclose($handle);
kgt Posted January 9, 2006 Posted January 9, 2006 Also keep in mind that Apache can be configured to limit download/upload sizes. I don't know about IIS. Contributions Discount Coupon Codes Donations
clp698 Posted January 9, 2006 Author Posted January 9, 2006 If you are not using download by redirect the php setting memory_limit is what causes the problem due to the readfile() function in download.php, you need to change it like below. http://www.oscommerce.com/forums/index.php?showtopic=166892 $chunksize = 32 * 1024; $buffer = ''; $handle = fopen(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'], 'rb'); if ($handle === false) { echo 'ERROR...'; die; } while (!feof($handle)) { $buffer = fread($handle, $chunksize); echo $buffer; } fclose($handle); Thanks for your input. I assume that I replace the above code with the stock code at the end of the download.php file. Also, would you advise using the download controller over the built in download feature?
clp698 Posted January 12, 2006 Author Posted January 12, 2006 Thanks for your input. I assume that I replace the above code with the stock code at the end of the download.php file. Also, would you advise using the download controller over the built in download feature? I made the changes to the download.php (installed on my local machine) as you indicated and it worked! Then I uploaded the file to my estore on my remote server (secure) and tried to download. The system hung for a long time and finally timed out (page not found). Then I created an unsecure store and uploaded the modified download.php file and tried the download and it worked! I was told that the php.ini file would need to be modified to allow for lengthy downloads. My hosting company won't let me modify that file and the only way I could customize it is by moving to a dedicated server, which is expensive. So at this point, I don't know if the problem is with the php.ini file or the secure server arrangement.
user99999999 Posted January 12, 2006 Posted January 12, 2006 Nothing needs to change in php.ini. Check the headers in this post to get it to work in SSL http://www.oscommerce.com/forums/index.php?showtopic=166892# #17
Recommended Posts
Archived
This topic is now archived and is closed to further replies.