Vous êtes sur la page 1sur 9

In HTML5, there are 3 supported video formats: MP4, WebM, and Ogg.

HTML Audio - Browser Support


In HTML5, there are 3 supported audio formats: MP3, Wav, and Ogg.

The browser support for the different formats is:

Browser MP3 Wav Ogg


Internet
YES NO NO
Explorer
Chrome YES YES YES
Firefox YES YES YES
Safari YES YES NO
Opera YES YES YES

For example, to increase the limit on uploaded files to 10 MB:

Add the below to the relevant php.ini file (recommended, if you have access). Note that
for some hosts this is a system-wide setting. However, for hosts running PHP as a CGI
script with suexec (for example) you may be able to put these directives in a php.ini file
in your Drupal root directory.
o upload_max_filesize = 10M
o post_max_size = 10M
Add the below to your .htaccess file in your Drupal root directory.
o php_value upload_max_filesize 10M
o php_value post_max_size 10M

The PHP documentation states that the memory_limit setting also affects file uploading.
Generally speaking, memory_limit should be larger than post_max_size. If this is an issue, see
the page on how to Increase memory available to PHP (3 methods)

Drupal also allows/enforces its own size limits, independently of what PHP allows. These are
found in Drupal 6 at "Administer Site configuration File uploads" ( /admin/settings/uploads ).
In Drupal 7 size limit is controlled on per-field basis. The Drupal settings cannot be larger than
those permitted by PHP, but may be smaller if you haven't updated them, so remember to check
there also, after updating the php.ini.
Skip to content

EasyEngine
WordPress on Nginx made easy!

Install
Docs
Community
EasyExperts
Blog
Contact
Careers

Search For :

Home Tutorials PHP Increase file upload size limit in PHP-Nginx

Increase file upload size limit in PHP-Nginx


If Nginx aborts your connection when uploading large files, you will see something like below in
Nginxs error logs:

[error] 25556#0: *52 client intended to send too large body:

This means, you need to increase PHP file-upload size limit. Following steps given below will
help you troubleshoot this!

Changes in php.ini

To change max file upload size to 100MB

Edit

vim /etc/php5/fpm/php.ini

Set

upload_max_filesize = 100M
post_max_size = 100M

Notes:

1. Technically, post_max_size should always be larger than upload_max_filesize but for


large numbers like 100M you can safely make them equal.
2. There is another variable max_input_time which can limit upload size but I have never
seen it creating any issue. If your application supports uploads of file-size in GBs, you
may need to adjust it accordingly. I am using PHP-FPM behind Nginx from very long
time and I think in such kind of setup, its Nginx to which a client uploads file and then
Nginx copies it to PHP. As Nginx to PHP copying will be local operation
max_input_time may never create issue. I also believe Nginx may not copy the file but
merely hand-over the location of file or descriptor records to PHP!

You may like to read these posts which explains PHP file upload related config in some details.

Change in Nginx config

Add following line to http{..} block in nginx config:

http {
#...
client_max_body_size 100m;
#...
}

Note: For very large files, you may need to change value of client_body_timeout parameter.
Default is 60s.

Reload PHP-FPM & Nginx

service php5-fpm reload


service nginx reload

Changes in WordPress-Multisite

If you are running WordPress Multisite setup, then you may need to make one more change at
the WordPress end.

Go to: Network Admin Dashboard >> Settings. Look for Upload Settings

Also change value for Max upload file size


More

You may need to change PHP max execution time limit also.
More optimization tips for WordPress-Nginx setup

Share this:

Facebook5
Twitter
Google
Reddit
Pocket
Email
Print

22 thoughts on Increase file upload size limit in PHP-


Nginx

1. Christian Varga says:

November 27, 2012 at 3:58 am

That final line was the one I needed, no other articles mention it. This should be the top
result in Google. Cheers!

1. Rahul Bansal says:

August 8, 2013 at 10:56 am

Thanks for appreciation.

2. Mike says:

April 7, 2013 at 8:56 pm

Hey Im having this same issue and I cant figure it out to save my self I want to be able
to upload files up to 300mb but my server doesnt let me. Please help.
1. Rahul Bansal says:

April 8, 2013 at 10:18 am

Apart from steps mentioned in above article, you may need to change
memory_limit in php.ini file.

Better would be to check error logs. You will see exact reason why 300MB files
are not uploading properly. It might be the case that they are getting uploaded but
are failing to process.

3. Farzana Neha says:

June 20, 2013 at 4:09 am

Thanks for the tips on how to increase file limit on nginx server. At first I edited php.ini
file but it didnt work properly. After checking your tips I just edited nginx.conf file and
now its working perfectly.

Thanks!

1. Rahul Bansal says:

August 8, 2013 at 10:56 am

There are few more things where PHP & Nginx both need changes. Coming from
Apache background, most of the time its hard to anticipate! I had spent hours
myself when I was new to nginx to find out this.

Glad to know it helped.

4. Jeffrey Adik says:

July 11, 2013 at 3:58 am

the multisite config had slipped my attention many thanks very helpful!

1. Rahul Bansal says:

August 8, 2013 at 10:54 am


We use multisite setup for on many client server. Thats how we managed to find
out that setting.

Glad to know it helped.

5. Kyle says:

August 7, 2013 at 2:18 am

I just HAD to leave a comment to say how much this helped me. Ive been scouring the
web for a solution to my 413 error and just knew it had something to do with nginx.
Much appreciated.

1. Rahul Bansal says:

August 8, 2013 at 10:53 am

Glad to know it helped.

6. David Radovanovic says:

September 12, 2013 at 6:05 pm

Works beautifully. Thanks for the concise and easy-to-understand instructions for a nginx
novice like me.

1. Rahul Bansal says:

October 14, 2013 at 6:51 pm

@David

Glad to know it helped.

7. Paul Grieselhuber says:

October 14, 2013 at 2:07 pm


Gold. This site has been invaluable for getting ramped up on Nginx and solving little
quirks along the way. Thanks!

1. Rahul Bansal says:

October 14, 2013 at 6:52 pm

@David

Thanks for appreciation. I hope you will find other tutorials in this series useful as
well.

8. Robson says:

October 17, 2013 at 11:20 am

Salved my magento, thank you very much

9. sam says:

November 29, 2013 at 11:04 am

I tried it. But its didnt works.

I tried it in http {} and server {}

my php setting is huge.

Maximum HTTP POST size === 200M


Maximum file upload size == 100M
Maximum execution time == 30000
Maximum input parsing time = 60000

Nginx config
client_max_body_size 100m;

uploading file size is 3 MB

1. Rahul Bansal says:

November 29, 2013 at 1:14 pm

Did you restart PHP-FPM and Nginx?


If yes, please check for error log. There could be some other issue.

10. Nikolay says:

December 24, 2013 at 5:00 pm

very GOOD !!!

11. Mark Greenall says:

January 11, 2014 at 1:45 am

This is a good tutorial thanks.

12. Thanks says:

February 17, 2014 at 9:30 pm

I just comment to say thank you Rahul..it save me lot of hours finding solution in the
web.your solution is easy to follow and concise nothing i find in google like
yours,everyone is just copy cat with other website lol!.again thank so much for your time
and effort.peace!

Comments are closed on this article.


Please use our free support forum for support and discussions.

Table of Contents

o Changes in php.ini
Notes:
o Change in Nginx config
Reload PHP-FPM & Nginx
o Changes in WordPress-Multisite
o More
o Share this:

EasyEngine
Install
Community Support (Free)

Documentation
Commands
Troubleshooting
Tutorials

About Us
Contact
Blog
FAQs

We are Hiring
DevOps Engineer

2017 - rtCamp Solutions Private Limited

Blog
Terms of Service

Vous aimerez peut-être aussi