500 Internal Server Error downloading large files

  • Posts: 7
  • Thank you received: 0
9 years 6 months ago #202087

-- HikaShop version -- : 2.4.0
-- Joomla version -- : 3.4.1
-- PHP version -- : 5.5.24
-- Browser(s) name and version -- : Chrome, IE, FF

Hey, sorry if i posted this in the wrong category but i found no suitable forum section for questions regarding the digital download options of hikashop.

On our website we want to sell several digital files from MP3s to videos in various resolutions/formats.
I created a first test file and product (a ~500MB ZIP file with some WAVs) and everything seems to workf fine.

i then created another product which consists of 4 different video/data files and while my customer was able to download both the 2MB PDF and a 1.35GB MP4 video he (and myself as well) got a 500 Internal Server Error when trying to download the other 2 files: a ~4,4 GB ISO and a 2,9GB WMV.

First i thought this issue is related to the PHP "max_execution_time" (which is set to 50000 by default from our hosting company) but since it took me ~90 secs to download the 500MB test file without any issues (and the client managed to download the even bigger 1.3GB file) i wonder if there is another file size issue maybe with the PHP handling the download?

Thanks
Robert

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 6 months ago #202110

Hi,

Yes, PHP might not be the most appropriate to send large file.
For example, HikaShop is using "filesize" (like Joomla).
php.net/manual/en/function.filesize.php

Note: Because PHP's integer type is signed and many platforms use 32bit integers, some filesystem functions may return unexpected results for files which are larger than 2GB.


So if you have a "500 Internarl Server Error" ; you should be able to see more details in your server log (and your PHP error log).
I suspect that some other functions in PHP for files are not perfect for large files (> 2GB)

I will recommend you to use the x-send-file method.
It will be less CPU/Memory consuming and it will be easier for the server to handle the large files.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 7
  • Thank you received: 0
9 years 6 months ago #202156

Hi Jerome, thank you for your fast response.

As i understand correctly, using x-send requires me to modify both the Apache webserver and as well the PHP script of hikashop that handles the file (as mentioned here for example www.jasny.net/articles/how-i-php-x-sendfile/ )?

best regards
Robert

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 6 months ago #202161

Hi,

You do not need to modify HikaShop to use "x-send".
We have already some code in the HikaShop class File which look at the apache modules and use "x-send" if the module "mod_xsendfile" is found.

So you just have to add/activate the module in apache.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: Fliegel

Please Log in or Create an account to join the conversation.

Time to create page: 0.060 seconds
Powered by Kunena Forum