The 2 MB PHP Attachment Limit

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Scam Warning
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
Locked
Verywavy
Registered User
Posts: 5
Joined: Fri Apr 14, 2006 10:32 am

The 2 MB PHP Attachment Limit

Post by Verywavy »

Okay guys, here's the deal. I know this has been addressed before in previous threads, but it has not been solved, at least for me.

I have worked with my web host to increase my upload attachment limit in php, utilizing a modified php.ini file. It works fine and when I do a check of the php info page for my server, it reflects 20 mb (which is what I increased it to).

Now, I have also worked to get phpBB 3.0 to recognize this new limit. It was not recognizing it after putting my php.ini file in my public_html folder. I found some info on the Net and basically, it was stated that this php.ini file has to be in every folder where there is a script associated with attachments. I did this and when I look at the php information page within the ACP of phpBB, it now reflects 20 mb as well.

The problem is, I tried attaching a file that was just bigger than the usual 2 mb limit (I think it was like 2.3 mb total size). The upload failed and I got this error message (see below graphic):

Image

Notice that the error message reflects the 20 mb limit as well. My question is... WTF? Why is the attachment of 2.3 mb failing when all indications tell me that I have a 20 mb limit set?

If anybody can help me solve this issue, I will be eternally grateful. I am looking to offer file downloads of larger than 2 mb, via my forum. This will obviously not be possible unless I can figure out what the heck is going on here. All I can say is this is VERY frustrating indeed. The whole thing seems senseless to me.

Thanks a million for any replies.

User avatar
karlsemple
Former Team Member
Posts: 39802
Joined: Mon Nov 01, 2004 8:54 am
Location: Hereford, UK
Contact:

Re: The 2 MB PHP Attachment Limit

Post by karlsemple »

Because that is not the only limit in the php.ini which is likely to need increasing to allow large files to be uploaded. Of course I am assuming that you have set the limits in the Admin panel correctly. In the php.ini to upload larger file sizes you are likely to need to increase these values also
Image

Verywavy
Registered User
Posts: 5
Joined: Fri Apr 14, 2006 10:32 am

Re: The 2 MB PHP Attachment Limit

Post by Verywavy »

Thanks a lot Karl. I appreciate your answer. I will give it a try and see if I can get it to work. If I do, I will post the results here so that others may forgo this annoying process. It just shouldn't be this hard to upload more than 2 MB. :evil:

Verywavy
Registered User
Posts: 5
Joined: Fri Apr 14, 2006 10:32 am

Re: The 2 MB PHP Attachment Limit

Post by Verywavy »

Okay, after much toiling I have managed to achieve the goal. I can now upload attachment files of any size I wish. It was partially Karl's idea, along with some other info I found, which made it possible. Endless kudos to all parties involved.

I'm going to go ahead and hopefully save somebody else the four hours of research and messing around it took to get this to work. I have attached detailed instructions and a sample php.ini file in a RAR archive. Enjoy!
Attachments
Large_File_Uploads_In_phpBB.rar
(838 Bytes) Downloaded 521 times

finnbee
Registered User
Posts: 1
Joined: Sun Feb 17, 2008 2:06 am

Re: The 2 MB PHP Attachment Limit

Post by finnbee »

Verywavy, thank you very much for that, it worked a charm and no doubt saved me hours of headache. Fortunately your post was the first I came across so I wasted no time!

Cheers again :geek:

rabbia_ed_amore
Registered User
Posts: 7
Joined: Tue Jan 15, 2008 2:30 pm

Re: The 2 MB PHP Attachment Limit

Post by rabbia_ed_amore »

Yeah I am going try that right now, and definetly your post helped more than anything else, I hope you don't mind if I msg u in the future about a question.

FYI:
The problem I've been having is a bit different however, I have a fresh installation of phpbb3 and I've been tweaking the values from 2mb to 200mb in both php.ini and ACP. But what happens is whenever I do upload a file of lets say 150mb. It takes the time to upload the whole thing and when it finally actually refreshes, I just get a blank page of creating a new post, even the stuff I've typed is gone and ofcourse the attachment will not show. So I am really bummed on it. Gonna try what u've done to see if it works. I have one minor difference up till now. I've only had my php.ini in my /cgi bin directory. I hope you can see the mistake I've been making. I'll try putting the php.ini in all the directories u said and try it then. But I'm doubting it'll work since my attachment sizes are massive.

Verywavy
Registered User
Posts: 5
Joined: Fri Apr 14, 2006 10:32 am

Re: The 2 MB PHP Attachment Limit

Post by Verywavy »

rabbia_ed_amore wrote:I'll try putting the php.ini in all the directories u said and try it then. But I'm doubting it'll work since my attachment sizes are massive.
First of all, I'm thrilled that the pain I went through solving this problem has actually helped some other people. I love it when that happens.

As for the massive attachment size, I don't think it really matters. I can set my limit to whatever I want now and it works just fine. I can't remember exactly, but I think before I solved the mystery of putting the php.ini file in the multiple folders, I was getting the same blank page error as you have experienced. Now, I can not guarantee that this solution will work with all server configurations, as I am on a shared host, using cPanel X. I hope it works out for you though. This was truly one of the most confounding issues I have ever experienced in the php realm, and a very hard subject to find definitive feedback on.

rabbia_ed_amore
Registered User
Posts: 7
Joined: Tue Jan 15, 2008 2:30 pm

Re: The 2 MB PHP Attachment Limit

Post by rabbia_ed_amore »

Yeah, I tried what u told me to, and its finally working now. It takes it sweet time to upload but then it actually does show up later. Thanks man. Really appreciate it. Will msg ya the next time I have problem with attachments..lol

kp3011
Registered User
Posts: 480
Joined: Fri Aug 27, 2004 4:58 am

Re: The 2 MB PHP Attachment Limit

Post by kp3011 »

Thanks for your info, but seems I still encounter the same problem. And Even if I uploaded files around 900KB it will give me a blank page.

I have already put in the php.ini's as directed above. The uploaded file existed in the /files/ folder, but it didn't make the corresponding records in the database.

Any ideas would be of help. Thanks.

Locked

Return to “[3.0.x] Support Forum”