Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-24-2012, 01:05 PM   PM User | #1
sorlaker
Regular Coder

 
Join Date: Dec 2009
Posts: 166
Thanks: 23
Thanked 1 Time in 1 Post
sorlaker has a little shameless behaviour in the past
PHP issue. "stopping working"

Hello guys i'm wrote a code that you upload images to a server and the PHP saves it and resizes it.

The array of images has ilimited "weight" and i've already set the post-max-size and upload-max-size at php.ini to 9999m and set set_limit_time(0);

but the result is that the code only render several files.

what should i do?
sorlaker is offline   Reply With Quote
Old 12-24-2012, 01:21 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,653
Thanks: 4
Thanked 2,451 Times in 2,420 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Check your error logs for any errors generated.
You also need to check for max_file_uploads as well. Needless to say, max sizes used to be capped at about 2GB, but I think its been increased. It of course must be < total server memory available, and preferably no more than 50% of available memory.
Fou-Lu is offline   Reply With Quote
Old 12-24-2012, 02:02 PM   PM User | #3
sorlaker
Regular Coder

 
Join Date: Dec 2009
Posts: 166
Thanks: 23
Thanked 1 Time in 1 Post
sorlaker has a little shameless behaviour in the past
Im at localhost so that total server memory u mean my ram memory?
sorlaker is offline   Reply With Quote
Old 12-24-2012, 02:30 PM   PM User | #4
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,653
Thanks: 4
Thanked 2,451 Times in 2,420 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Quote:
Originally Posted by sorlaker View Post
Im at localhost so that total server memory u mean my ram memory?
That's correct. You cannot give it more than your system memory for max sizes (post and uploads). Which leads to one more simple question: why are you using 10GB for your max filesize? If you need to move this many files or files this large you would be better off using FTP and cron to do the resizes.
Oh you'll probably need to increase the memory_limit as well. The default is 128M currently, which I believe is up from. . . 28 or was it 12?
Also your webserver software will have limitations, both in sizes and time to consider. Apache I believe has maximum timeout of 300 seconds, and LimitRequestBody of up to 2GB (although I believe the default is infinite).
Setting this so high requires a lot of changes in order to stick. I'd suggest you need at most 512MB. Even assuming that a larger bitmap (example: a google search pulled up a 1080p bitmap @ 5.9MB), you can still upload nearly 50 of them in that memory usage. I'd also suggest you move no more than 20 at a time.
Fou-Lu is offline   Reply With Quote
Old 12-24-2012, 03:53 PM   PM User | #5
sorlaker
Regular Coder

 
Join Date: Dec 2009
Posts: 166
Thanks: 23
Thanked 1 Time in 1 Post
sorlaker has a little shameless behaviour in the past
i've set the max_file_upload to 600 and it worked perfectly. i understand your point but what if the user can't/(doesn't want to install) use and ftp client?

if the user wants to upload 100 files. Can i split it and work with 20 separately?
sorlaker is offline   Reply With Quote
Old 12-24-2012, 03:59 PM   PM User | #6
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,653
Thanks: 4
Thanked 2,451 Times in 2,420 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Nothing says you cannot. You present a form with 20x uploads, then when complete you send them back to the form for the next 20.
Fou-Lu is offline   Reply With Quote
Users who have thanked Fou-Lu for this post:
sorlaker (12-29-2012)
Old 12-24-2012, 11:34 PM   PM User | #7
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,515
Thanks: 45
Thanked 440 Times in 429 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
Quote:
Originally Posted by sorlaker View Post
i understand your point but what if the user can't/(doesn't want to install) use and ftp client?
Well then it's (sorry to say) tough luck! We can't solve that for you, thats between you and the host / users to work out another way of doing it.

Quote:
Originally Posted by sorlaker View Post
if the user wants to upload 100 files. Can i split it and work with 20 separately?
Yes but you'll need to keep track of what files you've processed and what you haven't. That could be as simple as keeping them in different folders or recording them all in a database table.
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote
Users who have thanked tangoforce for this post:
sorlaker (12-29-2012)
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:30 PM.


Advertisement
Log in to turn off these ads.