Jump to content

Recommend PHP Settings for Downloads?


Recommended Posts

Hi There,

I'd like to raise the upload limit on my site to 300MB in IP Downloads. Chaging the upload size alone is not enough because large files are timing out and getting the "No File was selected for upload" error. From reading around it seems these settings need to be changed in my php.ini

max_execution_time = 30

max_input_time = 30

memory_limit = 64M

But changed to what? Anyone have recommendations for what these three settings should be set to for 300MB uploads? :unsure:

Link to comment
Share on other sites

First, disclaimer

PHP is not very good at handling large file uploads by nature. If you want to support huge files, I do suggest using alternative means like flash upload and then bind IPB to it.

Second point. Don't search google for this information unless you already know what's what. Because it's full of bad information.

Max execution time

Despite literally millions of tutorials out there that tells you to increase max execution time for this, you do not need to... /facepalm. They're just people following other people's advices without checking if it's true. Max execution time has no relevance to file uploads UNLESS your PHP attempts to do something with that uploaded file which takes time. For example, your PHP tries to do a rolling hash on the file and the hashing process takes 60 seconds because the file is enormous. All IPB would do is save the file, so execution is not important.

Max Input Time

Max input time is how long it takes to parse GET and POST in seconds. This is now how long it takes to upload, it's how long it takes for the OS to handle the file. To give an analogy, think of extracting from a zip file, you see the zip file extract than your windows moves it again. lol It's like the 2nd part. :tongue: 30 seconds, as you have is probably plenty unless you have a slow disk/processor. You can raise if you like. But a file parsing for over 30 seconds also means that you're disrupting every other service greatly.

Here's what it says in PHP docs.

This sets the maximum time in seconds a script is allowed to parse input data, like POST and GET. It is measured from the moment of receiving all data on the server to the start of script execution.

Ironically, the PHP pitfalls page conflicts with the docs stating that it includes uploading time. However, testing shows the docs is correct and it only counts for parsing the data.

Memory Limit

memory_limit is again, not important UNLESS the exception mentioned above applies. BUT IPB wants more than 64MB... IPB wants at least 128MB. Just FYI, it has little relevance to the actual question.

More!

But you do need to adjust these values

upload_max_filesize = 300M
post_max_size = 300M

PS... I should put this in my blog. lol

Link to comment
Share on other sites

Grumpy, thank for taking the time to explain that in english :rofl: I've been searching for a couple days now for a clear explaination of how it all works. I believe the issue lies in our htaccess file, I don't think it's been directed to the php.ini, so your recommended settings should work well. Thanks again!

Link to comment
Share on other sites

I had to change ex time exactly for what Grumpy mentioned, I run a php video converter alongside the forums that had issues with lower ex time as it starts processing stuff during uploads.

I was curious prior to actually needing that done and had experimented with it t see if it made any difference in ip.downloads or anything,, it did not.

Link to comment
Share on other sites

Does someone know fix for this:

Date: Tue, 29 Jan 2013 13:26:07 +0000
Error: 2006 - MySQL server has gone away
IP Address: - /files/getdownload/4851-enemy-territory-auto-pk3-cleaner/

I always get this while users are downloading files.

More than likely (not guaranteed) you need to increase the wait_timeout in /etc/my.cnf

Or it could be the max_allowed_packet also

What values are in your my.cnf ?

Link to comment
Share on other sites

is it always the one file or all files?


Nop. Most of the files in our download section.

More than likely (not guaranteed) you need to increase the wait_timeout in /etc/my.cnf

Or it could be the max_allowed_packet also

What values are in your my.cnf ?

wait_timeout = 90. Isn't that long enough?

Also max_allowed_packet is 96MB. I was never able to resolve that god damm error since months. I just have no clue what exactly is causing it.

Thanks!
Link to comment
Share on other sites

  • 9 months later...

First, disclaimer

PHP is not very good at handling large file uploads by nature. If you want to support huge files, I do suggest using alternative means like flash upload and then bind IPB to it.

Second point. Don't search google for this information unless you already know what's what. Because it's full of bad information.

Max execution time

Despite literally millions of tutorials out there that tells you to increase max execution time for this, you do not need to... /facepalm. They're just people following other people's advices without checking if it's true. Max execution time has no relevance to file uploads UNLESS your PHP attempts to do something with that uploaded file which takes time. For example, your PHP tries to do a rolling hash on the file and the hashing process takes 60 seconds because the file is enormous. All IPB would do is save the file, so execution is not important.

Max Input Time

Max input time is how long it takes to parse GET and POST in seconds. This is now how long it takes to upload, it's how long it takes for the OS to handle the file. To give an analogy, think of extracting from a zip file, you see the zip file extract than your windows moves it again. lol It's like the 2nd part. :tongue: 30 seconds, as you have is probably plenty unless you have a slow disk/processor. You can raise if you like. But a file parsing for over 30 seconds also means that you're disrupting every other service greatly.

Here's what it says in PHP docs.

Ironically, the PHP pitfalls page conflicts with the docs stating that it includes uploading time. However, testing shows the docs is correct and it only counts for parsing the data.

Memory Limit

memory_limit is again, not important UNLESS the exception mentioned above applies. BUT IPB wants more than 64MB... IPB wants at least 128MB. Just FYI, it has little relevance to the actual question.

More!

But you do need to adjust these values

upload_max_filesize = 300M
post_max_size = 300M

PS... I should put this in my blog. lol

i am interested in getting larger files to upload what is this flash you talk about how would it work where do i find it?ok i think you are talking about adobe flash? i am reading up on it but how do i get it into the gallery?

not sure what you mean by bind it ipb

Link to comment
Share on other sites

i am interested in getting larger files to upload what is this flash you talk about how would it work where do i find it?ok i think you are talking about adobe flash? i am reading up on it but how do i get it into the gallery?

not sure what you mean by bind it ipb

If you didn't get what I said, you'll need to hire a php & [insert 2nd language for file transfer here] programmer. It's not just something that comes out of the box nor is there an existing solution for you to install. Someone, somewhere will need to make one first, I merely suggested the route.

Link to comment
Share on other sites

  • 5 weeks later...

Can you link us to your blog please?

Dont mind if you prefer PM or not at all :thumbsup:

lol... It's not a blog with useful things like I probably make it sound. I meant I should post useful things in my blog instead of a rolling tumbleweed that's going on right now...

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...